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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2013
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    uploads not being saved, no errors

    multiUpload.php
    PHP Code:
    if(count($_FILES['filesToUpload']['name'])) {
        foreach (
    $_FILES['filesToUpload']['name'] as $file) {
            
            
    //do your upload stuff here
            
    echo $file ."<br />";   //outputs correct image name
            
    move_uploaded_file((string)$_FILES['filesToUpload']['name'],
                  
    'upload/' $file );
                  echo 
    "Stored in: " "uploads/" $file 
    The when I click the submit button in the code below, the php above echos the correct file name, and says "Stored in: uploads/filename.png

    But when I open the uploads folder it's always empty. I changed it's privileges to allow full access.

    I've tried a few different parameters for move_uploaded_file such as $file(since it outputs the correct string).


    html
    Code:
    <form method="post" action="multiUpload.php" enctype="multipart/form-data">
      <input name="filesToUpload[]" id="filesToUpload" onChange="makeFileList();" type="file" multiple="true" />  
    <ul id="fileList"><li>No Files Selected</li></ul>
    <input type="submit" action="submit" value="Submit">
    </form>
    Any ideas?

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,004
    Thanks
    15
    Thanked 236 Times in 236 Posts
    Way off, also the submit input doesn't need a name, id or action, just a value.
    Here's a couple of multi-upload scripts from the forum.

    Multiple uploads with a single selection.

    Multi-upload Script

    There's plenty more out there.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • Users who have thanked DrDOS for this post:

    lmbarns (07-17-2013)


  •  

    Posting Permissions

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