Forums

File upload in different folders does not work

patrick.h 05 Aug, 2019
Hi,

the file upload in different folders does not work in my case. Where is my mistake?
Upload in standard folder works

Admin:





debug results:

patrick.h 07 Aug, 2019
Nobody has a suggestion?!?!
GreyHead 07 Aug, 2019
Hi Patrick,

Are you trying to upload the same file twice? I'm not sure that will work as the first upload will move the file from the PHP upload folder into the CF folder you specified.

If you need a copy you can do that with Custom PHP after the first upload.

Bob
patrick.h 07 Aug, 2019
Hi GreyHead,

No, I tried to upload a different file each time.
healyhatman 07 Aug, 2019
Put the following in a PHP block, in the "Fail" event of your file upload action, and tell me what it says.

foreach($_FILES as $name => $file) {
if(!isset($file["error"]) {
echo "File " . $name . " didn't have an error";
}
else {
echo "Error for file " . $name . " - ";
$error = $file["error"];
switch($error) {
case 0:
echo "There was no error - the file was uploaded successfully.";
break;
case 1:
echo "The uploaded file exceeded the upload_max_filesize in the server setttings";
break;
case 2:
echo "The uploaded file exceeded the max file size specified by the form";
break;
case 3:
echo "The uploaded file was only partially uploaded";
break;
case 4:
echo "No file was uploaded";
break;
case 6:
case 7:
case 8:
echo "Error code 6, 7, or 8.";
break;
default:
echo "No valid error code was supplied, so your guess is as good as mine as to what's going on";
}
}
echo "<br>";
}
patrick.h 07 Aug, 2019
Hi healyhatman,

you forgot a ")" here
if(!isset($file["error"]) {

Here the result: Error for file file1 - There was no error - the file was uploaded successfully.

But there is no file in my folder

healyhatman 07 Aug, 2019
Answer
On the first tab, try and untick the "file uploads" button or whatever it's called.
Also try in the "custom file config" adding in "nameofyourfileuploadfield:commaseparatedlistofallowedextensions"
patrick.h 07 Aug, 2019
1 Likes
Thanks a lot

Disable "Upload files" works fine

This topic is locked and no more replies can be posted.