Forums

Need assistance with File Upload & Email upload confirmation

revive 01 Oct, 2008
Hello,
I have searched high and low, read FAQ 29 and the others pertaining to uploading files, and have implemented all of them... I don't understand the directions on this post ( http://www.chronoengine.com/forums.html?cont=posts&f=2&t=10832&p=11901&hilit=verify+input#p11901 ) about how to implement the code from the bottom of the chronocontact.php file to allow me to change the upload directory...
What I am trying to do: Create a form within the registered users menu that allows them to upload a file to a specific folder, and then have that upload filename email to me.

Any help is greatly appreciated!
Thanks again!!!

Jesse

FYI: I'm running Joomla! 1.5.7 and CF 3.0 current (downloaded today)
GreyHead 01 Oct, 2008
Hi Jesse,

A bit longwinded but I'd probably put some code in the OnSubmit Before to move the file from ChronoForms generic upload folder to wherever you want it. At the same time you can build the link to it to go into the email.

This is 'safer' than hacking the CF code as you don't have to re-hack on an upgrade. And, unless the files are very big, moving them twice probably won't cause any significant problems or delays.

Bob

PS Max is much more familiar with the v3 code and may have a better suggestion.
Max_admin 01 Oct, 2008
Hi revive, this upload folder is constant ? or depending on the user ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
revive 02 Oct, 2008
Yes, the folder location is constant... and the files range in size from 40MB to 70MB each... one per upload.

Also, due to the size of the files,.. is there a way to make the submit button work only once and have a java window pop up that says its uploading, and then closes when its done, leaving the user to see the redirected page?

Thank you! You guys are great!
Max_admin 02 Oct, 2008
Hi revive,

if you want to change the upload path then find and change this line at components/com_chronocontact/chronocontact.php:

$uploadedfile = JFile::upload($original_name, JPATH_COMPONENT.DS.'uploads'.DS.$formname.DS.$filename);


a JS upload image is not hard to do, you can tie a popup to the button click the any popup blocker will block it I think!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
revive 02 Oct, 2008
Hey Max,

Thank you!! I'm not too savvy what it comes to forms and JS... could so head me in the right direction with the HS progress bar / or / pop up til the file uploads??

Cheers
Max_admin 02 Oct, 2008
Hi, I really never did it before, maybe google "JS File upload bar" or indicator... but I don't have something to give about this!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
revive 02 Oct, 2008
Hey Max,

No worries,.. I'll search google and see what we come up with.. thanks again! The support here is second to none!

I will be discussing your extension with the site owner, with my recommendation to purchase the license and support you in this project!

Thanks again!

Jesse
Max_admin 02 Oct, 2008
Thanks revive!

Best regards

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
eliasdabbas 03 Oct, 2008
Hi All,

My question is related to uploading files, but I'd really appreciate a solution without having to go in the code:)

I want to have my users upload images to my site using Chronoforms, and then I want these images to be viewable from a different component (phocagallery, RS2 gallery, etc) I want a great form for good user experience in upload, and great display by other specialized components. Of course I want to have the images searchable by category, username, date, etc...
Basically a photo sharing site.

Any idea how to integrate these two functionalities?

Thanks a lot
Elias
Max_admin 03 Oct, 2008
Hi Elias, you will need to examine whats necessary for phoca to list the photos (Basically data get stored in some table and images uploaded to some place) then the form should do this so I'm sure 200% that you will need to use code more than the one above!🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 03 Oct, 2008
Hi eliasdabbas,

PhocaGallery supports fornt-end upload, you might want to look at that. I think that the upload process adds categories, saves to a user folder and creates a thumbnail so there is quite a lot of processing that you will need to design and build to have CF form do this for you.

Bob
Nikkole 08 Dec, 2008

Hi revive,

if you want to change the upload path then find and change this line at components/com_chronocontact/chronocontact.php:

$uploadedfile = JFile::upload($original_name, JPATH_COMPONENT.DS.'uploads'.DS.$formname.DS.$filename);


a JS upload image is not hard to do, you can tie a popup to the button click the any popup blocker will block it I think!

Cheers

Max




Hi Admin! I have searched this on this forum for about 15 minutes, did not an answer yet. I found this thread. So, instead of creating new topic, I decided to ask my question here.

What if I want file uploads to be uploaded on a different folder on my server? Say i want my files to be uploaded on to /site/images/members/photos -- instead of default chrono folder? I see you suggested to "change this line" above, but what line? Where? Which one to what? Could you please explain how and where I can change the upload folder path?

Thank you very much!
Nikkole 08 Dec, 2008
Will it work if I change the "uploads" to "http://www.mysite/com/images/etc.?

Like:

$uploadedfile = JFile::upload($original_name, JPATH_COMPONENT.DS.'http://www.mysite/com/images'.DS.$formname.DS.$filename);

$attachments[$allowed_s2[0]] = JPATH_COMPONENT.DS.'http://www.mysite/com/images'.DS.$formname.DS.$filename;

Am I right? Or is it wrong?

Thanks!
GreyHead 08 Dec, 2008
Hi Nikkole,

Well, yes, kind of. It needs a path *not* a URL. I think you want
$uploadedfile = JFile::upload($original_name, JPATH_BASE.DS.'images'.DS.$formname.DS.$filename);

Bob
Nikkole 08 Dec, 2008
There are multiple lines that has the path:

1. if(!JFile::exists(JPATH_COMPONENT.DS.'uploads'.DS.$formname.DS.'index.html')){
if(!JFolder::create(JPATH_COMPONENT.DS.'uploads'.DS.$formname)){
JError::raiseWarning(100, 'Couldn\'t create upload directroy 1');
}
if(!JFile::write(JPATH_COMPONENT.DS.'uploads'.DS.$formname.DS.'index.html', 'NULL')){
JError::raiseWarning(100, 'Couldn\'t create upload directroy 2');
}

2. if ( $fileok ) {
$uploadedfile = JFile::upload($original_name, JPATH_COMPONENT.DS.'uploads'.DS.$formname.DS.$filename);//handle_uploaded_files($original_name, $filename);
$posted[$allowed_s2[0]] = $filename;
JRequest::setVar($allowed_s2[0], $filename);
if ( $uploadedfile ) {
$attachments[$allowed_s2[0]] = JPATH_COMPONENT.DS.'uploads'.DS.$formname.DS.$filename;

3. {
$uploaded_files = "";
$upload_path = JPATH_SITE.'/components/com_chronocontact/upload/';
if ( is_file($uploadedfile) ) {
$targetfile = $upload_path.$filename;
while ( file_exists($targetfile) ) {
$targetfile = $upload_path.rand(1,1000).'_'.$filename;
}
move_uploaded_file($uploadedfile, $targetfile);
$uploaded_files = $targetfile;
}
return $uploaded_files;
}

Do I have to change the "uploads" to "image" and the last one /components/com_chronocontact/upload/ to /images/myimages/ ??? Or just change the frst 2 lines :

$uploadedfile = JFile::upload($original_name, JPATH_COMPONENT.DS.'http://www.mysite/com/images'.DS.$formname.DS.$filename);

$attachments[$allowed_s2[0]] = JPATH_COMPONENT.DS.'http://www.mysite/com/images'.DS.$formname.DS.$filename;

And don't touch the rest?
Max_admin 08 Dec, 2008
Hi Nikkole,

why are you trying to change this ?

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Nikkole 09 Dec, 2008
I am trying to change this (if it is possible, if not I will leave it like that) so I should be able to access/view the uploaded images through joomla admin backend, instead of going to FTP and download them. There is a media folder in joomla where all the images are stored in. Or is there any other way to view or download or use the uploaded images?
Max_admin 09 Dec, 2008
Hi Nikkole,

as you said, only FTP, that's correct, you will need these changes to edit it, give it a try and let me know what happens!

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.