Forums

file upload path without slash

webwichtl 02 Feb, 2014
In the "Files Upload" form action, the upload file path (absolute server path) contains no slash in the end, regardless whether I enter it or not. Thus the file gets uploaded into the parent directory, and its name starts with the target directory name.
Example:
This is my upload file path: /html/dev/data/upload/
This is my file name: test.csv
This is what I expect after uploading: /html/dev/data/upload/20140202215256_test.csv
This is what I really get: /html/dev/data/upload20140202215256_test.csv
Since the slash after "upload" is missing, the file resides in the /html/dev/data/ directory. The $_FILES["myform"]["name"] variable still contains test.csv

And one more bug: obviously it is not possible to set an upload file type with 1 valid extension only. You have to explicitely set the extensions separator and define at least 2 valid extensions, otherwise you get the File type error.

By the way, where is the option for changing the upload file name pattern?

Greets,
Moni
Max_admin 04 Feb, 2014
Hi Moni,

Thank you, this is a bug, I didn't test with a custom path, it should work fine with the default path, the fix for the first issue, in the file_upload action, find this line:
$upload_path = substr_replace($upload_path, '', -1);


and comment or delete it!

2nd issue should not happen, what's your file config string ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Erik66 07 Mar, 2014
Hi Max, I have the same error and tried your fix. It did not help.

Best regards,

Erik
Erik66 07 Mar, 2014
By the way, there's a small typo in the error message:

Couldn't create upload directroy

Best regards,

Erik
Max_admin 07 Mar, 2014
Hi Erik,

Please try to add a slash to the end of your path ? or leave the path field completely empty and that should use the default path.

this problem has been fixed in the new release, hopefully to be published this weekend!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Erik66 07 Mar, 2014
Hi Max,

removing the path from the path field completely solves the issue. I look forward to the new release, thank you very much.

Erik
castagno 08 Dec, 2014
Hi, I read this interesting discussion.

I'm using V5 and I look to this article to change the "static_path"

http://www.chronoengine.com/faqs/53-cfv4/cfv4-file-uploads/2630-how-can-i-upload-files-under-some-users-folder.html

Now in my case it doesn't work..so I leave empty the Upload Path field in Upload_Field Action and I create the custom code as In the article( I only change the N°77 with my Form ID)

The image is uploaded but in the chronoform's default field?

Could some one help me?

Thanks
Max_admin 08 Dec, 2014
Hi Castagno,

You should use the action id, the number in the blue box of the uploads action!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
castagno 08 Dec, 2014
Hi MAx, thanks for your quickly reply.

I modified my code like this

<?php
$user =& JFactory::getUser();
$form->actions_config[3]["upload_path"] = "upload/test".DS.$user->get('username').DS;
?>

WHERE 3 is the id of Field Upload Action that I put in "on submit"

and upload/test is the folder in Chronoforms where I'd Like the images go

But nothing works....;-(
Max_admin 08 Dec, 2014
The code should be inside a "custom code" action ABOVE the "File uploads".

Also, your path is not complete, you must use a full absolute path, you can find this path under the "System information" in Joomla or in the manual extensions installer!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.