| View previous topic :: View next topic |
| Author |
Message |
DeMiNe0
Joined: 21 Apr 2008 Posts: 1
|
Posted: Mon Apr 21, 2008 5:14 pm Post subject: Having a Hard time understanding how to get started |
|
|
Hey everyone,
I'm pretty new to using PHP and Java. I'm trying to use jumploader to do a very simple upload to a website. I have one directory that i want users to upload images too. I just need the server handler code in php and the applet to use. Im sure i have them both, but im not sure how to make this work.
I have the uploadhandler from the documentation up, and when i upload a file it shows a green checkbox (Not a warning icon) on the thumbnail.
I look in the directory though, and it has not uploaded. I put the full path to the directory in the handler code.
This is my Handler:
<?
//
// 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' ] . "/home/xxxx/xxxxx/imgup/upload/" . $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";
}
?>
I've also tried $target_file_path = $_SERVER[ 'DOCUMENT_ROOT' ] . "/home/xxxx/xxxxx/imgup/upload" . $file_name;
with no results.
Also the upload dir is chmodded to 777.
And this is my applet:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<applet name="jumpLoaderApplet"
code="jmaster.jumploader.app.JumpLoaderApplet.class"
archive="jumploader_z.jar"
width="600"
height="400"
mayscript>
<param name="uc_uploadUrl" value="uploadhandler.php"/>
</applet>
</body>
</html> |
|
| Back to top |
|
 |
jmaster Site Admin
Joined: 01 Jan 1970 Posts: 1175
|
Posted: Mon Apr 21, 2008 6:46 pm Post subject: |
|
|
| consider using generic html upload form instead of applet. thus you should be able to see server response in browser window. when this works, replace upload form with applet. |
|
| Back to top |
|
 |
robfaas
Joined: 24 Apr 2008 Posts: 15
|
Posted: Thu Apr 24, 2008 1:15 pm Post subject: Same |
|
|
I had the same problem until I found out that in the uploadHandler.php I had to change the $target_file_path to the absolute path and even escape the backslashes:
[code]$target_file_path = "C:\\domains\\mydomain.com\\wwwroot\\uploaded\\".$file_name;[/code] |
|
| Back to top |
|
 |
|