473,387 Members | 1,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

upload file

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
3 2679
Motoma
3,237 Expert 2GB
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
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
3,237 Expert 2GB
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

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

Similar topics

1
by: Muppy | last post by:
I've created a page with a form to upload files: <h1>Upload di un file</h1> <form enctype="multipart/form-data" method="post" action="do_upload1.php"> <p><strong>File da trasferire:</strong><br>...
5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
1
by: Selena | last post by:
I have vb.net windows application which need to upload file to server. It can run properly without using VPN. How can I run it with VPN? Is there any components or code to upload file? Or is there...
3
by: Brian | last post by:
Hi, I've been trying to find a way to upload file to another site that is not using IIS. The site that I want to upload file to has a simple php script to receive file uploaded through standard...
1
by: akiko | last post by:
i am student and i must to do project about web app by Ruby on rails i can not do past upload file.i try looking code but i just meet upload file image. i want to code upload file that it must to...
4
by: bienwell | last post by:
Hi all, I developed an web page in ASP.NET to upload file into the server. In the Web.config file, I declared <httpRuntime executionTimeout="1200" maxRequestLength="400000" /> The MAX...
4
by: google.com | last post by:
Hi there! I've been digging around looking for a sample on how to upload a file without user action. I found the following article covering the area: ...
6
by: | last post by:
Hi, I use upload control, how to enable upload *.pdf file and enlarge file size? Please help.
1
by: printline | last post by:
Hello all I have a php script that uploads a file from a form into a directory. The directory is automatically created through the script. But the upload file is not put in to the directory,...
2
by: lka527 | last post by:
I am trying to make a site available for someone to *upload* certain type of text file (.txt) that can be parsed by written code. the upload file is available on the main site but I need this to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.