Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Need Little Help Working File Upload Script

    Hi all. I would like to fist say Hi as i am brand new to this site. I have a code that works great. It is an upload form that will let the user upload three files through three separate browse upload lines. Only problem with the code that I currently use is that if the user does not upload three files I get this error:

    Warning: copy() [function.copy]: Filename cannot be empty in /home/dedikate/public_html/www.file-warehouse.com/multiple_upload_ac.php on line 19

    Warning: copy() [function.copy]: Filename cannot be empty in /home/dedikate/public_html/www.file-warehouse.com/multiple_upload_ac.php on line 20


    Here is my code:

    PHP Code:
    <?php //set where you want to store files
    //in this example we keep file in folder upload //$HTTP_POST_FILES['ufile']['name']; = upload file name
    //for example upload file name cartoon.gif . $path will be upload/cartoon.gif
    $path1"upload/".$HTTP_POST_FILES['ufile']['name'][0];
    $path2"upload/".$HTTP_POST_FILES['ufile']['name'][1];
    $path3"upload/".$HTTP_POST_FILES['ufile']['name'][2];
    //copy file to where you want to store file
    copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
    copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
    copy($HTTP_POST_FILES['ufile']['tmp_name'][2], $path3);
    //$HTTP_POST_FILES['ufile']['name'] = file name
    //$HTTP_POST_FILES['ufile']['size'] = file size
    //$HTTP_POST_FILES['ufile']['type'] = type of file
    ?>

    I got this code from http://www.phpeasystep.com/phptu/2.html

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,209
    Thanks
    15
    Thanked 253 Times in 253 Posts
    That's a very clumsy script. There are a couple of multi-upload scripts in the snippet section, I wrote one of them, just rewrote a single upload script to handle multi uploads.

  • Users who have thanked DrDOS for this post:

    neusight (08-06-2012)

  • #3
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    That's a very clumsy script. There are a couple of multi-upload scripts in the snippet section, I wrote one of them, just rewrote a single upload script to handle multi uploads.

    I looked through your code and tried it out. It seems it's only for uploading images.
    Last edited by neusight; 08-03-2012 at 08:32 PM.

  • #4
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,209
    Thanks
    15
    Thanked 253 Times in 253 Posts
    Quote Originally Posted by neusight View Post
    I looked through your code and tried it out. It seems it's only for uploading images.
    You just change it to whatever you want to upload. You need to get the correct mime type for your files. It's just a general purpose upload script, it just happens that images are one of the most popular items to upload.

  • Users who have thanked DrDOS for this post:

    neusight (08-06-2012)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •