473,748 Members | 10,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

file uploading problem

ganesanji
16 New Member
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="multip art/form-data">
<input type="hidden" name="MAX_FILE_ SIZE" value="20000" />
Names file: <input type="file" name="myfile">
<input type="submit" name="upload" value="UploadFi le" class="butt">
</form></center>

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

Any body help me....
I will greatfull for you.........tha nks....
Oct 11 '07 #1
3 1913
MarkoKlacar
296 Recognized Expert Contributor
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 Recognized Expert Expert
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 Recognized Expert Specialist
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
1868
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 server connection lost and time out some no responce is there any solution to that problem using asp.net and c thank
1
2205
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 uploading a file to the server is 4Mo but I changed that maximum to about 10Mo in my web.config file : <httpRuntime executionTimeout="45" maxRequestLength="10000" useFullyQualifiedRedirectUrl="true" />
4
5730
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 file is finished uploading but am not sure how to do it while file is uploading. Some sample code would be welcomed with open arms. Thank You.
13
4317
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 that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I cleanup files that were uploaded -- but obviously left stranded when the users aborted/gave up writting...
3
5051
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 around 7MB/s. I'm using a FileUpload control on an .aspx page, and then I'm writing the MyFileUpload.PostedFile.InputStream off to a database. What can I do to speed up this uploading? Thanks in advance
1
2079
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 on Win2003, IIS, ASP.Net 1.1. The page works fine if running from localhost. It only has problem when accessed from a domain name.
12
2909
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 workstation it works fine, but when I publish the page on our DEV server it doesn't fine the CSV file from the client. Has anyone done this before? If so, how do I do it? I'm new to ASP.net so
7
3190
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" name="file_1" size=46 /><input type=submit /> so, after adding a few files, the input fields look like this:
0
1407
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 maybe from configuration of php or apache. I will describe how it works. When you selects file on the form and click upload, uploading starts
0
9548
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9325
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
8244
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...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
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
4607
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
3315
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
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.