You don't need both lines. It's only important to set $targetDir to a valid path - or more to say to an expected path. The main problem with this setting is that most user don't know expect the files being uploaded to PHPs temp directory (and then are not moved anywhere more "useful").

I can confirm that I have the same issues with db, website and forms encoded as UTF-8.

So again, how can I subscribe to this topic? Don't see any link here.
Which version is this PunBB? From 2004?
Is anyone from Moxiecode/plupload reading the forum at all?

3

(4 replies, posted in General discussion)

If you use e.g. the example "queue widget" and leave the folder structure as is in the download .zip. $targetDir ='./uploads' should work ... ok, you have to make sure, for your runtime the path is set to ../upload.php (which it's not for all runtimes, except flash. Then, if you have a folder for all plupload files (e.g. "plupload") you should find the uploaded files in ./plupload/examples/uploads (make sure uploads is writeable).

Try

    function (id) {

(without "$")

5

(4 replies, posted in General discussion)

The default $targetDir directory is within PHP's tmp folder, where you normally can't look at in a (shared) hosting environment. The file normally is moved to your own htdocs folder with move_uploaded_file(). Unfortunately plupload does NOT move the file by default. So I bet it either is in PHP's tmp folder as described above, OR you've set an incorrect path for $targetDir, and the file is not uploaded at all (even if the GUI says it is).

Where are the "subscribe to this topic link"(s) ?
The only way is to reply ... wink

Try var_dumping phps upload dir - and this should NOT be empty!

var_dump(ini_get("upload_tmp_dir"));

Also see end of upload.php, if the file get's renamed there to a different path!

// I am using this path in example widget queue as tmp upload dir
// and then I rename to the same directory
$targetDir = './uploads';

// ...

if (!$chunks || $chunk == $chunks - 1) {
  $rename_path_filename = $targetDir.'/'.$_FILES['file']['name'];
  rename("{$filePath}.part", $filePath);
  rename($filePath, $rename_path_filename);
}

Seems like $fileName is wrong, or the files don't really upload (or at least not to phps tmp dir php/tmp/plupload/). Try to echo $fileName and make sure the $targetDir exists and is writeable.

Read here about moving upload:
http://www.plupload.com/punbb/viewtopic … 7118#p7118

The ARRAY could be build like this:

$tmp_array = ARRAY(
"cat_id" => array(0=> "12", 1=>"6"),
"file_title" => array(0=>"asd", 1=>"sa"),
"html5_uploader_0_tmpname"=> "p16tq8bb351d1b6f25lv1b481bji4.jpg",
"html5_uploader_0_name"=> "99999 (8).jpg",
"html5_uploader_0_status"=> "done",
"html5_uploader_1_tmpname" => "p16tq8bb35p91sfkm4v8u85d65.jpg",
"html5_uploader_1_name"=> "99999 (5).jpg",
"html5_uploader_1_status" => "done",
"html5_uploader_count" => "2"
);


// here: 'html5_uploader' from the uploader queue widget
$your_id_for_the_uploader_form = 'html5_uploader';

$uploaded_array = ARRAY();

for ($i=0; $i< $tmp_array[$your_id_for_the_uploader_form.'_count']; $i++) {
  $uploaded_array[$i] = ARRAY();
  $uploaded_array[$i]['cat_id'] = $tmp_array['cat_id'][$i];
  $uploaded_array[$i]['file_title'] = $tmp_array['file_title'][$i];

  $uploaded_array[$i]['status'] = $tmp_array['html5_uploader_'.$i.'_status'];
  $uploaded_array[$i]['name'] = $tmp_array['html5_uploader_'.$i.'_name'];
  $uploaded_array[$i]['tmpname'] = $tmp_array['html5_uploader_'.$i.'_tmpname'];
}

print '<pre>';
var_dump($uploaded_array);
print '</pre>';

Additional data may be send after the files have been uploaded. If you then presse the submit button in the example queue, the data of the form (with hidden file and perhaps your additional data) gets send to dump.php. If you var_dump($_POST) there, you should see all your data.

You can move the files via move_uploade_file. BUT, you can only do this in the code before this line: Here the temporary upload file gets deleted.

@unlink($_FILES['file']['tmp_name']);

You may process your "files to blob" in either dump.php or upload.php. But I would recommend upload.php.

12

(3 replies, posted in General discussion)

The code I provided is working. Just make sure you copy it at the correct position and adjust your ids/selectors correctly. Try a simple alert() before doing more complicated stuff.

13

(1 replies, posted in General discussion)

You can find it out if you get your forms (examples htmls <form action="dump.php" ...>) to output the POST after uploading.

in upload.php, you can set $targetDir

But the default setting is not really a destination folder - it is a subfolder in "tmp" where "normal" downloads are stored before moving to final destination

// default
//$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . 
//
// set you own path
$targetDir = './uploads';

// or (this assumes, you have session_start() somewhere before)
$targetDir = './'.$_SESSION['index_for_directory_or_path'];

Well, this is not coded in upload.php - you will have to move the files on your own (at e.g. the end of upload.php file)

16

(6 replies, posted in General discussion)

Most likely the option 'url': 'upload.php' which is incorrect. For the examples files you have to change the option to 'url': '../upload.php' for all runtimes. (Only flash is set correctly in v1.5.4 files)

17

(1 replies, posted in General discussion)

in upload.php, at the very end, the file is renamed from .part to tmp/id filename. There you could just rename the file back to the original. Also you could add a line to move the file to a diffent (if still in tmp) directory

if (!$chunks || $chunk == $chunks - 1) {
//var_dump($filePath);
//var_dump($targetDir);
//var_dump($_FILES['file']['name']);
$rename_path_filename = $targetDir.'/'.$_FILES['file']['name'];
//var_dump($rename_path_filename);
//
// Strip the temp .part suffix off
rename("{$filePath}.part", $filePath);
rename($filePath, $rename_path_filename);
}

You have to upload the file, then process/read the file into your database.

How to use images as blob in databases is findable via

http://lmgtfy.com/?q=mysql+store+image+blob

And before you start you should read about why it is not a good idea to store images in databases at all.

19

(3 replies, posted in General discussion)

// get uploader instance (adjust to your #id)
var uploader = $("#html5_uploader").pluploadQueue();

uploader.bind('UploadComplete', function(up, files) {
  // your code on upload completed
});

The forms in the examples show a "send" button. This button could be clicked without that any files has been added or uploaded. Also it is confusing to have add files, upload and send buttons all at once. So, remove the "send" button until files have been uploaded:

I added id "plupload_submit" to submit buttons in example html files

<input id="plupload_submit" type="submit" value="continue" />

This goes in the javascript part, between $(function() { ... });

  // initially, hide submit button
  $("input#plupload_submit").hide();

  // When all uploads are completed, show button
  // Change event to 'FileUploaded' if you want to show the button, if at least one file was uploaded successful
  uploader.bind('UploadComplete', function(up, files) {
    $("input#plupload_submit").show();
  });

The solutions given here work. At least if you do not try to add files again, after you added some before. These solutions here will only limit adding files at once (so e.g. 2 at once) but not in total.

To limit max total upload files or addable files, you would have to count files with event BeforeUpload or other suitable.

uploader.bind('FilesAdded', function(up, files) {
    // max files allowed to be uploaded
    var max_files = 2;
    //
    // get amount of files already added to the queue
    // + ignoring the inital text, saying to drop files there which is a li also
    var cur_files = $("#html5_uploader_filelist li").not(".plupload_droptext").length;
    //
    // previous and currently added files sum up to files_total
    var files_total = files.length + cur_files;
    //
    if (files_total > max_files) {
      alert('You are allowed to add only ' + max_files + ' files.');
      up.splice(); // reset the queue to zero);
    }
  });

Ok, and to even make it more complicated, you will have to adjust var max_files = 2 if user had uploaded files before and is not allowed to upload e.g. 10 files in total. So you will have to check first, if user still is allowed to upload more files and how many.

How to get the complete path and filename? Or does the browser only return this unique ID/filename for security reasons?

/test1/filename.jpg
/test2/filename.jpg

could be same, but also different. So just checking the filename is not enough.