Attribute File Upload

Views: 18,624

Results 21 to 31 of 31
24 Aug 2008, 6:46 PM
#21
misscharlotte avatar

misscharlotte

New Zenner

Join Date:
May 2008
Location:
Pennsylvania
Posts:
25
Plugin Contributions:
0

Attribute File Upload

Is the attribute for uploading a file only for images? I would like customers to be able to upload a text file or maybe a MS Word document. Is there a way to associate file types that are acceptable to upload (ie., .doc, pdf, .txt, etc.)?

-Melissa

24 Aug 2008, 6:58 PM
#22
misscharlotte avatar

misscharlotte

New Zenner

Join Date:
May 2008
Location:
Pennsylvania
Posts:
25
Plugin Contributions:
0

Re: Attribute File Upload

Ok, I finally found the answer to my question. I just couldn't remember where to find file types accepted to upload. It's under "Configuration", "Maximum Values" and then "Allowed Filename Extensions for uploading". I added the filename extensions I needed.

-Melissa

24 Aug 2008, 7:03 PM
#23
franck avatar

franck

New Zenner

Join Date:
Jul 2008
Location:
Paris, France
Posts:
5
Plugin Contributions:
0

Re: Attribute File Upload

Glad you found it. It's easy to set.

But the upload function is buggy. I still haven't been able to make the upload required.

And if a user tries to upload an unacceptable file type associated with a product, the error message displays in the cart... where the product has already been added.

Franck

24 Aug 2008, 7:09 PM
#24
misscharlotte avatar

misscharlotte

New Zenner

Join Date:
May 2008
Location:
Pennsylvania
Posts:
25
Plugin Contributions:
0

Re: Attribute File Upload

Thanks for replying. Do you know the file extension for a MS Word 2007 document? When I look under the file properties, it just says "MS Word Document". I've tried the .doc extension and the file is being rejected when I try to add it to my shopping cart for testing purposes.

-Melissa

24 Aug 2008, 7:22 PM
#25
misscharlotte avatar

misscharlotte

New Zenner

Join Date:
May 2008
Location:
Pennsylvania
Posts:
25
Plugin Contributions:
0

Re: Attribute File Upload

Yippie! Word 2007 uses the XML file format and uses the extension .docx. The file is no longer being rejected. I double checked and I can read the file too! It never hurts to check whether or not the file was saved without being corrupted.

-Melissa

25 Aug 2008, 12:15 PM
#26
franck avatar

franck

New Zenner

Join Date:
Jul 2008
Location:
Paris, France
Posts:
5
Plugin Contributions:
0

Re: Attribute File Upload

misscharlotte:

Yippie! Word 2007 uses the XML file format and uses the extension .docx. The file is no longer being rejected.

When you say the wrong file exension was rejected, can you tell me where the system was catching the error. If you choose a PDF file, for example, and then click Add To Cart, what happens? Does the error stop you on the product information page, or do you get directed to the Cart page with the item in the cart and NO FILE uploaded?

This is the glitch I was referring to. If you're getting another behavior, I'd love to hear how it's working for you.

2 Sep 2008, 3:39 PM
#27
pasmith avatar

pasmith

New Zenner

Join Date:
Aug 2008
Posts:
9
Plugin Contributions:
0

Re: Attribute File Upload

Franck, did you ever figure out a way to make an upload required?

I'm in the same boat as you...without a logo the order is basically incomplete, so I'd really like to make it required.

25 Sep 2009, 8:10 AM
#28
thomasharding avatar

thomasharding

Zen Follower

Join Date:
Sep 2007
Location:
Manchester, England
Posts:
168
Plugin Contributions:
0

Re: Attribute File Upload

Congratulations are due to the ZC developers for missing this one out. Whats the point of a file upload if no-one can view it!!

:cheers:

25 Sep 2009, 8:30 AM
#29
peanut77 avatar

peanut77

Zen Follower

Join Date:
Feb 2005
Posts:
266
Plugin Contributions:
0

Re: Attribute File Upload

You can view it - I use the image/file upload on a few sites.

Basically you need to make the upload folder read/writeable (I also added an htaccess file to this folder)

Then zen cleverly remanes the files and tells you the image name (if you look at the order placed with the file/image is attached to you'll see it there

Then you simply go to https://www.mywebsite.co.uk/images/zenname.jpg%28/gif/doc/pdf) then right click and save.

Of if you have ftp access simply download.

Easy peasy!

29 Jul 2010, 1:18 PM
#30
totalsam avatar

totalsam

Zen Follower

Join Date:
Jan 2009
Posts:
126
Plugin Contributions:
0

Re: Attribute File Upload

Hey,

I have used the following method to make a link in my orders page to the image, however I have 11 different upload attributes (long story) and this creates a rather unsightly bit of code which isn't very flexible.

The code now looks as follows:

//echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
		  		echo '<br><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ';
		if (($order->products[$i]['attributes'][$j]['option'] == "1") or ($order->products[$i]['attributes'][$j]['option'] == "2") or ($order->products[$i]['attributes'][$j]['option'] == "3") or ($order->products[$i]['attributes'][$j]['option'] == "4") or ($order->products[$i]['attributes'][$j]['option'] == "5") or ($order->products[$i]['attributes'][$j]['option'] == "6") or ($order->products[$i]['attributes'][$j]['option'] == "7") or ($order->products[$i]['attributes'][$j]['option'] == "8") or ($order->products[$i]['attributes'][$j]['option'] == "9") or ($order->products[$i]['attributes'][$j]['option'] == "10") or ($order->products[$i]['attributes'][$j]['option'] == "1.")){
		$full_logo_name  = $order->products[$i]['attributes'][$j]['value'];
$pieces = explode(".", $full_logo_name);
		echo ' <a href="' . HTTP_SERVER . DIR_WS_CATALOG . '/images/uploads/' . $pieces[0] . '.' . $pieces[2] . '" target="_blank">' . nl2br($order->products[$i]['attributes'][$j]['value']) . '</a>';
		} else {

Obviously this would be 1,000,000's of times better if it had one "if" statement, which checked if the product_option_type was "file" and then did the same process. Does anyone know how to modify this?

ORIGINAL METHOD:

boylan:

Continuing on the bad practice described above - I have changed the .htaccess file to allow access to the uploaded images from IP address of the store owner - and created a link on the edit order page to view the file. To do this on your site:
(using 1.3.5)
change line 401 of admin/orders.php FROM:

      echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);
> TO:
> ```
//          echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);
		echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ';
		if ($order->products[$i]['attributes'][$j]['option'] == "Logo 1" || $order->products[$i]['attributes'][$j]['option'] == "Logo 2" || $order->products[$i]['attributes'][$j]['option'] == "Logo 3" || $order->products[$i]['attributes'][$j]['option'] == "Logo 4" || $order->products[$i]['attributes'][$j]['option'] == "Logo 5") {
		$full_logo_name  = $order->products[$i]['attributes'][$j]['value'];
$pieces = explode(".", $full_logo_name);
		echo nl2br($order->products[$i]['attributes'][$j]['value']) . ' <a href="/images/uploads/' . $pieces[0] . '.' . $pieces[2] . '" target="_blank">View ' . $pieces[0] . '.' . $pieces[2] . '</a>';
		} else {
		echo nl2br($order->products[$i]['attributes'][$j]['value']);
		}

Which results in something like this:
Logo 1: 4. joomla_logo_black.jpg View 4.jpg

The above only works because the Option Name for uploaded images is "Logo 1" through "Logo 5". If the Option Name for your uploaded file is different, then change those names. It will also fail if there is more than one "." in a filename - but I'm not sure Zen-Cart would allow it to be uploaded.

It currently works on my site, but no guarantees. Hope this helps some people - its not a full uploaded file editor, but it will allow unskilled store admins to at least see the uploaded files referenced without typing a bunch of stuff.

12 Oct 2011, 8:40 PM
#31
luxifer avatar

luxifer

New Zenner

Join Date:
Mar 2009
Posts:
57
Plugin Contributions:
0

Re: Attribute File Upload

This is an old thread, but I'm having a problem with this exact problem.
I have an attribute that is a file upload (an image that the customer supplies. I've added it to the product.
When I do a test order, I add a file (and yes, it's an allowable filetype) and submit the order, but there is nothing that says that the file was uploaded, and the shopping cart doesn't show that a file was attached, and the /images/uploads folder is empty.
(yes, I set the permissions to 777 and the .htaccess to allow writes)

Any more ideas?

Just one idea...
In the options Name Manaager, it says option type: File, but in the Attribute Controller the Option Value is Text. I think that's correct, as text refers to the filename, but I'm not sure.