views:

1622

answers:

2

I'm trying to get uploadify to send it's files to a php script but it comes back blank every time... i'm totally confused as sometimes it won't even attempt to upload the files.

Form:

<form action="upload.php?1" method="post" id="uploadForm" enctype="multipart/form-data">
<input type='file' name='uploadBox' id='uploadBox' /><br/>
<input class="button" type="submit" value="{Upload}" />
<script type="text/javascript">
     // makes the flash uploader work
     $(document).ready(function(){
      $('#uploadBox').uploadify ({
      'uploader'  : 'uploader.swf?PHPSESSID=4aa17bc8a50f8265ee27ec5fb469d7e5',
      'script'    : 'upload.ajax.php?PHPSESSID=4aa17bc8a50f8265ee27ec5fb469d7e5',
      'cancelImg' : 'cancel.png',
      'auto'      : false,
      'sizeLimit' : '8388608',
      'buttonText' : "Browse",
      'multi'  : true,
      'fileExt' : "*.jpg;*.jpeg;*.png",
      'scriptData': {'album':"1", "session":"4aa17bc8a50f8265ee27ec5fb469d7e5"},
      onError : function(event, queueID, fileObj, errorObj){ alert("ERROR"); console.log(errorObj); }
      });
      $("#uploadForm .button").click(function(){
       $("#uploadBox").uploadifyUpload();
       console.log("uploading...");
       return false;
      });
      console.log("attached");
     });
     </script>
</form>

And this is the upload.ajax.php file: Notes on it: it requires the session to be working for it to work and add_to_album does all the thumbnail work and stuff

<?php
// upload photos via background flash thingy mobob
include "../../functions.php"; start($_REQUEST['PHPSESSID']);
include "../../inc/photo.php";
// we need to upload this file we've got to the normal stuff we use :D
if(!is_logged_in()){
    echo "0";
    exit;
}
$fail = false;
foreach($_FILES as $file){
    if(add_to_album($file['tmp_name'], $_REQUEST['album']) == false)
     $fail = true;
}
echo "upload has finished";
if($fail == true)
    echo "0";
else
    echo "1";
A: 

What is the foreach for? If you input filename is called uploadBox check for $_FILES['uploadBox ']['tmp_name'].

Elzo Valugi
It's for my script to catch anything... it doesn't want to upload anything... it's very confusing
kennyisaheadbanger
A: 

AHA! Just realized the major problem with it. The start() function was looking for a langauge, failed and told the script to die... so it wouldn't work

BAM! Everything lit up and it worked :D

YAY :D

kennyisaheadbanger