Call-back icon  Enterprise Sales: +1.310.775.2674 (N. America)   +44 20.3286.4137 (UK)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Java Help with file uploader
 
swissters
Jr. Member
 
Total Posts:  29
Joined:  2008-04-23
 

Hello everyone! 

I have been playing around with this Java Uploader for my clients.  It allows them to upload custom images to be used on personalized products.  At the moment it is just a stand alone uploader, but I was wondering if anyone knew how to add this into the “My Account” Section so customers can upload files to “their” directory. 

http://renderedclothing.com/upload

Here is the code that I used to integrate it, it was really easy to add into a CMS page:

<applet name="jumpLoaderApplet"
        
code="jmaster.jumploader.app.JumpLoaderApplet.class"
        
archive="jumploader_z.jar"
        
width="685"
        
height="400" 
        
mayscript>
    <
param name="uc_uploadUrl" value="/media/uploadHandler.php"/>
</
applet>

and here is the uploadHandler.php:

<?php
    
//----------------------------------------------
    //    upload file handler script
    //----------------------------------------------

    //
    //    specify file parameter name
    
$file_param_name 'file';

    
//
    //    retrieve uploaded file name
    
$file_name $_FILES[ $file_param_name ][ 'name' ];

    
//
    //    retrieve uploaded file path (temporary stored by php engine)
    
$source_file_path $_FILES[ $file_param_name ][ 'tmp_name' ];

    
//
    //    construct target file path (desired location of uploaded file) -
    //    here we put to the web server document root (i.e. '/home/wwwroot')
    //    using user supplied file name
    
$target_file_path $_SERVER[ 'DOCUMENT_ROOT' "/media/clientuploads/" $file_name;

    
//
    //    move uploaded file
    
echo "Moving file " $source_file_path " > " $target_file_path ": ";
    if( 
move_uploaded_file( $source_file_path$target_file_path ) ) {
        
echo "success";
    
} else{
        
echo "failure";
    
}

    
//
    //    below is trace of variables
?>
<html>
<
body>
    <
h1>GET content</h1>
    <
pre><?print_r$_GET );?></pre>
    <
h1>POST content</h1>
    <
pre><?print_r$_POST );?></pre>
    <
h1>FILES content</h1>
    <
pre><?print_r$_FILES );?></pre>
</
body>

Anybody have any good ideas on how to have it automatically grab the client ID or order number when it uploads?  I’m new to JAVA so any help is appreciated. 

I hope people have a use for this tool.  I was messing around with it last night and it works flawlessly in Magento. 

I don’t think I can attach the Java file, so here is the link to this Applet: http://www.jumploader.com/

Any help is appreciated.

Nate

 Signature 

Eco-Friendly Custom Screen Printing and Web Design:
RenderedClothing.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
jmacdoug
Sr. Member
 
Avatar
Total Posts:  78
Joined:  2007-12-03
 

I would love to see this working on my site as well. Jumploader looks great. I actually like swfupload as well. http://www.swfupload.org/

Please, please, I could really use this just as you have mentioned above in the “My Accounts” section. Although, it would be nice as a “Custom Option” preferably

 Signature 

Jeff MacDougall
http://www.modebook.com
MAGENTO INSTALLATION http://www.modebook.com/dev
gulp

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
© Copyright 2009 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
108779 users|271 users currently online|199888 forum posts