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

uploading files using php and apache

im trying to upload a file using php and apache and i get a blank screen when i submit the file. the php and apache are configured correct as i can open a test php file and as the file i want to upload is small there shouldnt be any problem with the size.can anybody help me?
Mar 22 '07 #1
3 5777
Banfa
9,065 Expert Mod 8TB
What is the script you upload to supposed to output?
Mar 22 '07 #2
What is the script you upload to supposed to output?
this is the code for the submit file:

<html>
<head>
<title>file upload</title>
</head>

<body>
<h2>upload</h2>
<FORM ENCTYPE = "multipart/form-data" ACTION = "upload_file.php" METHOD = "POST">
<INPUT TYPE = "HIDDEN" NAME = "MAX_FILE_SIZE" VALUE = "20000">

Filename:
<INPUT NAME = "userfile" TYPE = "file">
<BR>
<BR>
<INPUT TYPE = "submit" VALUE = "send">
</FORM>
</BODY>
</HTML>


this is the php upload file:

<?
if ($userfile == "none"){
echo "No file specified";
exit;
}
if (move_uploaded_file($userfile,"\\uploads\\".$userf ile_name)){
echo "your file has been uploaded";
}else{
echo "could not upload file";
}
?>
Mar 22 '07 #3
Motoma
3,237 Expert 2GB
When you upload, your file will be located in $_FILES['userfile'] not $userfile.

this is the code for the submit file:

<html>
<head>
<title>file upload</title>
</head>

<body>
<h2>upload</h2>
<FORM ENCTYPE = "multipart/form-data" ACTION = "upload_file.php" METHOD = "POST">
<INPUT TYPE = "HIDDEN" NAME = "MAX_FILE_SIZE" VALUE = "20000">

Filename:
<INPUT NAME = "userfile" TYPE = "file">
<BR>
<BR>
<INPUT TYPE = "submit" VALUE = "send">
</FORM>
</BODY>
</HTML>


this is the php upload file:

<?
if ($userfile == "none"){
echo "No file specified";
exit;
}
if (move_uploaded_file($userfile,"\\uploads\\".$userf ile_name)){
echo "your file has been uploaded";
}else{
echo "could not upload file";
}
?>
Mar 23 '07 #4

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

Similar topics

0
by: news.sympatico.ca | last post by:
I've built an uploader for an application I'm working on but it won't allow uploading of png, movie files, etc. It works fine for jpg, gif, txt, and other ones. Is there some place the sets what...
2
by: Robert | last post by:
Hi, I've been trying today to upload a file using a script from a book I've been learning from. The script work's fine, except for whe the naem of the file contains an apostrophe... e.g. " '...
6
by: Will Stuyvesant | last post by:
I am uploading a .zip file to a Python CGI program, using a form on a HTML page with <input name="yourfile" type="file">... In the Python CGI program I do: import cgi fStorage =...
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: Dean Richardson | last post by:
Hi, I'm having trouble uploading files via a PHP script. Whenever I upload a file greater than 10K, the file gets corrupted. However, text files upload OK. When I check the FTP Server log I...
7
by: jambroo | last post by:
Hello, We are currently having issues uploading files using PHP. It seems files below 8MB are uploaded fine, however files above 8.2MB cause the page to timeout or show a 'Cannot find server or...
5
by: Silencet | last post by:
Hey every one, I've recently set up a site using http/php and have been studing php for a while, i've got a problem of trying to upload a video, i cam to this site, because alot of my C++...
2
by: =?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?= | last post by:
jodleren escribió: I haven't found the PHP manual page where such feature is documented but a few tests have shown that this behaviour changes depending on the charset parameter of the...
11
by: swethak | last post by:
Hi, My Requirement is to upload the images into database through jsp. For that i write a code .And it works fine .But in that File imgfile = new File("C:/Program Files/Apache Software...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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
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,...

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.