473,396 Members | 1,996 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,396 software developers and data experts.

file uploading problem

ganesanji
hi all,

I have written a php coding for uploading a file to a specific folder or location in
server which is a Linux server. I think the coding for file uploaing is correct.
But it does not work properly. That means the file is not uploaded to the specified location. It always executes the "else" condition in my coding.
I think the problem is lieing in the specifed path which is the target path for file uploading. I could not find out the solution for that. Please any body help me...

I attached the coding below.......
[php]
<form action="<? echo $PHP_SELF; ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="20000" />
Names file: <input type="file" name="myfile">
<input type="submit" name="upload" value="UploadFile" class="butt">
</form></center>

if($_POST)
{
$path = '/var/www/uploads/';
$path .= $_FILES['myfile']['name'];
$_SESSION['path']=$path;
if(move_uploaded_file($_FILES['myfile']['tmp_name'],$path))
{
echo "Successfully uploaded";
}
else
{
echo "Uploading Error";
}
}
?>
[/php]
In this coding it always executes "Uploading Error".....

Any body help me....
I will greatfull for you.........thanks....
Oct 11 '07 #1
3 1895
MarkoKlacar
296 Expert 100+
Hi,

have you looked at php.net? Here you will find examples of how to cope with the $_FILE.

Start here, I know it's not that difficult.

Cheers
Oct 17 '07 #2
Markus
6,050 Expert 4TB
Hmmm...

Is that supposed to be a comma? - in the if statement..?
Expand|Select|Wrap|Line Numbers
  1. if(move_uploaded_file($_FILES['myfile']['tmp_name'],$path))
  2.                                                  //^ comma?
  3.  
I'm thinking it should be a fullstop :)
Oct 18 '07 #3
ronverdonk
4,258 Expert 4TB
ganesanji: Next time enclose any code within the proper code tags.

See the Posting Guidelines on how to do that.

moderator
Oct 18 '07 #4

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

Similar topics

3
by: Mike | last post by:
Hi i have a problem in asp.ne i am uploading file to the server using htmlinput controls and every thing is o but i try to upload larger file to the server like more than 4 mb and about 10mb i got...
1
by: Jonathan | last post by:
Hi everyone, I have a problem with the file uploading in Asp.Net and I have read a lot on forums on this but never found an answer. Here is the problem: I know Asp.Net maximum Length for...
4
by: Kenneth Keeley | last post by:
Hi, I have a page that uploads files to my server and I wish to display a "Please wait while uploading" page to the user while the file is uploading. I have been able to redirect the user once the...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
3
by: Mike Kelly | last post by:
Hi. I've built a page using standard ASP.NET 2.0 features and when I upload a large file (>20MB) to our intranet server, I get a paltry 100KB/s on our 100Mb/s LAN. Simply copying the file, I get...
1
by: wenqiang7 | last post by:
I am encountering a very strang problem with file uploading in my ASP.Net page. When we try to upload certain file, we'll get an error msg of "Cannot find server or DNS Error". We are running...
12
by: SAL | last post by:
Hello, Is it possible to read a CSV from the Client, and bind my Datagrid to the data in the CSV file without uploading the file to the Server first? I have tried and in Debug mode on my...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
0
by: tower.grv | last post by:
Hello. I have created file upload progress bar. It coded with php and AJAX. The problem is it works on some servers but doesn't work on another. Maybe it depends from php or apache version. But...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
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,...

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.