-2

hello i am looking script image and html or text file upload with option make file name and file deletion
any body can help?

3
Contributors
7
Replies
34
Views
3 Years
Discussion Span
Last Post by mattster
0

So google:

  • PHP upload (you will learn how to rename there)
  • PHP delete file

Not that difficult, but at least show some effort and try!

0

You can find what you need in the documentation.

Here is a small example. I haven't tested out but will give you some good direction.

//Form processing
if(isset($_POST['submit'])){

        $upload_folder = 'uploads/';

        if(isset($_POST['new_file_name'])){
            $file_path = $upload_folder . $_POST['new_file_name'];
        }else{
            $file_path = $upload_folder . basename($_FILES['file']['name']);
        }

        if( move_uploaded_file($_FILES['file']['tmp_name'], $file_path)){
            echo 'File has been uploaded';
        }else{
            echo 'Error, file has not been uploaded';
        }

    }



    //Submit Form

    <form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
        <input type="text" name="new_file_name" value="" placeholder="Give new filename (Optional)" />
        <input type="file" name="file" value="" />
        <input type="submit" name="submit" value="Submit File"  />
    </form>
0

not showing any file uploads folder,
somthing wrong

Edited by kaakka: spell

1

not showing any file uploads folder,
somthing wrong

So show us some code so we can help you.

Again: Show some effort and try.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.