By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,777 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

upload file

P: 7
i'm not able to upload file from mobile J2ME to php 5.2.2, plz help me for that,
same code is running in php4.3, but not in php5.2.2.
I'm using $_FILES for uploading file, while using

print_r($_FILES), it showname,type and
error=3 and size=0

why this is happened?
plz help me .
May 21 '07 #1
Share this Question
Share on Google+
3 Replies


Motoma
Expert 2.5K+
P: 3,235
i'm not able to upload file from mobile J2ME to php 5.2.2, plz help me for that,
same code is running in php4.3, but not in php5.2.2.
I'm using $_FILES for uploading file, while using

print_r($_FILES), it showname,type and
error=3 and size=0

why this is happened?
plz help me .
Please post the relevant code. Use the [code] tags.
May 21 '07 #2

P: 3
php.ini file setting for upload file is :

upload_max_filesize 10M
upload_tmp_dir /var/tmp


Here is the code :

$uploadDir = '/home/';

$uploadDir = $uploadDir . $_FILES['file']['name'];

$content_length = $_SERVER['CONTENT_LENGTH'];
echo "content_length=".$content_length;

if(move_uploaded_file($_FILES['file']['tmp_name'], $uploadDir))
{
print "File is valid, and was successfully uploaded. ";
print_r($_FILES);
}

else
{
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}


And Output is :

content_length=929
Possible file upload attack! Here's some debugging info:
Array
(
[file] => Array
(
[name] => walahlight_bar901.png:206
[type] =>
[tmp_name] =>
[error] => 3
[size] => 0
)

)

it upload the file from browser but not able to upload file send from mobile(J2ME) to server. And same code is worked in php4.3.11 but not in php5.2.2. Is there any other configuration with apache2.0.59?

plz help me to find out the answer.

thank you!
May 22 '07 #3

Motoma
Expert 2.5K+
P: 3,235
php.ini file setting for upload file is :

upload_max_filesize 10M
upload_tmp_dir /var/tmp


Here is the code :

$uploadDir = '/home/';

$uploadDir = $uploadDir . $_FILES['file']['name'];

$content_length = $_SERVER['CONTENT_LENGTH'];
echo "content_length=".$content_length;

if(move_uploaded_file($_FILES['file']['tmp_name'], $uploadDir))
{
print "File is valid, and was successfully uploaded. ";
print_r($_FILES);
}

else
{
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}


And Output is :

content_length=929
Possible file upload attack! Here's some debugging info:
Array
(
[file] => Array
(
[name] => walahlight_bar901.png:206
[type] =>
[tmp_name] =>
[error] => 3
[size] => 0
)

)

it upload the file from browser but not able to upload file send from mobile(J2ME) to server. And same code is worked in php4.3.11 but not in php5.2.2. Is there any other configuration with apache2.0.59?

plz help me to find out the answer.

thank you!
Check the permissions on the temp directory. It appears that the file is not getting uploaded correctly. Can you try it out on a standard web browser?
May 22 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.