473,765 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

upload file

7 New Member
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 2724
Motoma
3,237 Recognized Expert Specialist
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
aratimane
3 New Member
php.ini file setting for upload file is :

upload_max_file size 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_len gth;

if(move_uploade d_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_bar9 01.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 Recognized Expert Specialist
php.ini file setting for upload file is :

upload_max_file size 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_len gth;

if(move_uploade d_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_bar9 01.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
2878
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> <input type="hidden" name="MAX_FILE_SIZE" value="1000000"> <input type="file" name="img1" size="30"> </p> <p> <input type="submit" name="submit" value="Upload File">
5
5468
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. I want to develop a webpage where people can send attachments that are stored on their local PC.
1
2827
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 any method to get Ip assigned by VPN? Thank you.
3
2433
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 http post with a file upload. However, how do I upload file to the site using asp.net? thanks Brian
1
7263
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 filter (validate) when file is PDF or postscript.if you have code or you can tell me please help me. ps.i want to upload PDF and postscirpt file and when i upload file finish file will store at database i will download file return? thank you
4
11122
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 length is 129M or more for each file upload. I have 2 files upload at the same time. Therefore, I set the timeout is 20min and the size of file upload is 390MB (400,000 KBytes).
4
9182
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: http://www.motobit.com/tips/detpg_uploadvbaie/ It describes the vba code required to handle a very simple upload form:
6
1928
by: | last post by:
Hi, I use upload control, how to enable upload *.pdf file and enlarge file size? Please help.
1
8290
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, but outside.... Can anyone tell what i am doing wrong....?? And perhaps tell me what to do to put the file into the created directory...? Here is my code:
2
9440
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 result in different page on the right as someone clicks on SUBMIT with one's file attached. The uploaded file by clicking submit button should be PARSED on the right side of the page but when I click on the submit with the file now, it goes to the local...
0
9399
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9957
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.