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").
Plupload Forum
Search options
Plupload Forum → Posts by djot
Pages 1
Posts found: 22
1 2012-05-30 08:47:43
Re: Uploading A File, Not creating the file. (1 replies, posted in General discussion)
2 2012-05-24 16:02:38
Re: German characters ÄÖÜäöüß get lost (4 replies, posted in General discussion)
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 2012-05-24 15:53:06
Re: Files doesn't saved (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).
4 2012-05-24 09:38:54
Re: Breaks jQuery: function $(id) {return document.getElementById(id);} (4 replies, posted in General discussion)
Try
function (id) {
(without "$")
5 2012-05-24 09:31:35
Re: Files doesn't saved (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).
6 2012-05-23 14:45:35
Re: Server Side Error Reporting not Happening (5 replies, posted in General discussion)
Where are the "subscribe to this topic link"(s) ?
The only way is to reply ...
7 2012-05-22 16:19:08
Re: Get the first uploaded file under temp folder using html5 uploader (4 replies, posted in General discussion)
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);
}
8 2012-05-22 15:55:43
Re: Get the first uploaded file under temp folder using html5 uploader (4 replies, posted in General discussion)
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.
9 2012-05-22 14:42:12
Re: Get an array of all the uploaded files using method = POST (4 replies, posted in General discussion)
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>';
10 2012-05-21 20:49:26
Re: Get an array of all the uploaded files using method = POST (4 replies, posted in General discussion)
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.
11 2012-05-21 07:40:34
Re: how to upload file to mysql blob field (3 replies, posted in General discussion)
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 2012-05-21 07:26:19
Re: event all files uploaded? (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 2012-05-19 08:20:14
Re: Have a custom upload.php (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.
14 2012-05-19 08:14:38
Re: Problem ussing PHP $_SESSION with destination folder (1 replies, posted in General discussion)
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'];
15 2012-05-19 08:09:30
Re: Uploads to temp Folder but does not move to upload folder (1 replies, posted in General discussion)
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 2012-05-19 08:06:52
Re: Error -200 on Upload (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 2012-05-19 07:33:21
Re: uploaded file names (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);
}
18 2012-05-19 07:28:34
Re: how to upload file to mysql blob field (3 replies, posted in General discussion)
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 2012-05-19 07:23:19
Re: event all files uploaded? (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
});
20 2012-05-19 07:19:40
Topic: [tutorial] Prevent user from clicking form submit "send" button (0 replies, posted in General discussion)
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();
});
21 2012-05-19 07:09:57
Re: How to restrict number of uploaded files (30 replies, posted in General discussion)
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.
22 2012-05-19 07:00:06
Re: How to disable duplicate files upload (22 replies, posted in General discussion)
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.
Posts found: 22
Pages 1
Plupload Forum → Posts by djot
You are not logged in. Please login or register.
Powered by PunBB, supported by Informer Technologies, Inc.
The pun_repository official extension is installed. Copyright © 2003–2009 PunBB.
Generated in 0.166 seconds (96% PHP - 4% DB) with 5 queries