Zen Cart Logo
Forums / General Questions / Admin Web Access to Customer Image Uploads?

Admin Web Access to Customer Image Uploads?

Views: 1,424

Results 1 to 6 of 6
19 Nov 2012, 5:48 PM
#1
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Admin Web Access to Customer Image Uploads?

Admin Web Access to Customer Image Uploads?

I see that the images/uploads directory is block http access, which makes sense as you wouldnt want anyone access these files.

however, Is there a way I can set it up so that my client can access the files through web interface if logged into the admin area?

I really want to simplify this for her and potentially make a custom code that adds a clickable link on the order page which will either display or download the image for the order.

Can anyone suggest anything I can do?

Thanks

Phil

Phil Rogers
A problem shared is a problem solved.

19 Nov 2012, 6:29 PM
#2
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Admin Web Access to Customer Image Uploads?

I just found this example:

<?php
$file = 'monkey.gif';

if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}
?>

I am going build a link which will use GET to pull the order id, then from this I will select the image from the attribute on the order.

then I will strip the image filename back to the unique number for the file that exists on the server, which I will then chuck into the above code, and hopefully this will work :)

I will post back if its a success, in the mean time if anyone has any better suggestions please let me know.

Ta

Phil

Phil Rogers
A problem shared is a problem solved.

20 Nov 2012, 6:39 PM
#3
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Admin Web Access to Customer Image Uploads?

OK here is my solution. i've taken a more simplistic approach.

I have added this to admin/orders.php:

<div style="width:400px; padding-bottom:20px;">
<h3>Order Image Downloads</h3>
<form target="_blank" action="download.php" method="post">
Enter the image file name, for example <strong>2.jpg</strong> if the uploaded files shows as <strong>2. Myimage.jpg</strong> on the product option line. Then click submit to download.
<br />
<input type="text" name="fname" />
<input type="Submit" name="Submit">
</form>
</div>

and then uploaded a file called download.php to the admin directory with this code:

<?php 
$number = $_POST["fname"]; 
$file = '/home/yourpath/public_html/images/uploads/' . $number;
if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
exit;
}
?>

Hope this helps anyone else with the same requirements and if anyone spots any mistake or potential problems doing it in this way please let me know :)

Phil Rogers
A problem shared is a problem solved.

21 Nov 2012, 4:54 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Admin Web Access to Customer Image Uploads?

Thanks for posting your solution to this issue ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Nov 2012, 4:08 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Admin Web Access to Customer Image Uploads?

It sounds like you've got a solution; there's also the Customer Uploaded Files plugin: http://www.zen-cart.com/downloads.php?do=file&id=1134

7 Feb 2013, 10:19 AM
#6
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Admin Web Access to Customer Image Uploads?

lat9:

It sounds like you've got a solution; there's also the Customer Uploaded Files plugin: http://www.zen-cart.com/downloads.php?do=file&id=1134

ah man how did I not find this!!! lol

Phil Rogers
A problem shared is a problem solved.