Post by toth_sandor » Thu Jun 21, 2012 6:13 pm

Hi,

We are operating an online gift shop and I've got a problem with option file upload.
I would like to let our customers upload pictures and show them when the process is ready.
I've modified the related part of ajaxupload, but the content of json.file is not the real filename of the uploaded picture. So I can't use this one. Can anyone help me?

Thank you in anticipation!

Newbie

Posts

Joined
Thu Jun 21, 2012 6:05 pm

Post by Avvici » Fri Jun 22, 2012 11:54 am

The code you want to look at is this: /admin/controller/catalog/download.php

Code: Select all

if (!isset($json['error'])) {
			if (is_uploaded_file($this->request->files['file']['tmp_name']) && file_exists($this->request->files['file']['tmp_name'])) {
				$ext = md5(mt_rand());
				 
				$json['filename'] = $filename . '.' . $ext;
				$json['mask'] = $filename;
				
				move_uploaded_file($this->request->files['file']['tmp_name'], DIR_DOWNLOAD . $filename . '.' . $ext);
			}
Specifically: $ext = md5(mt_rand());
AND THIS:
move_uploaded_file($this->request->files['file']['tmp_name'], DIR_DOWNLOAD . $filename . '.' . $ext);

As you can see your normal file name is being concatenated with a random string.

Just make this: $ext = md5(mt_rand()); like this:

Code: Select all

$ext = '';

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by Rosettes » Mon Jul 02, 2012 9:15 am

Hi there,
My problem i think is similar but not the same as I do not have the same error's in the coding. So please can you help me?
I want to know where the images go to when they are uploaded to the system from a customer? (I have 2 places for files to be uploaded in my listings in the shop)
My orders say the image name but I can't find where they are uploaded to on in my cpanel ...?

User avatar
Newbie

Posts

Joined
Wed Feb 29, 2012 4:43 am


Post by Avvici » Mon Jul 02, 2012 3:20 pm

Two places. They go to the /image/data/ as well as the /image/cache. Depending upon where the image is called on the website it will under go a resizing and caching to the cache folder. Therefore you could have many different versions of the same image all cached with different sizes/proportions. The main image always resides in the /image/data folder(s)

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC
Who is online

Users browsing this forum: No registered users and 48 guests