473,399 Members | 3,401 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,399 software developers and data experts.

Uploading viles via php

Hello, I tried uploading a file via the following method, however it
does not work, I was wondering what I did wrong as I can not see it.

form.html
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" id="file" />
<input type="hidden" value="hey" id="joe" />
<input id="submit" type="submit" value="Upload" />
</form>

upload.php
<?php
print_r($_FILES);
?>

Jun 7 '07 #1
5 1340
On Jun 7, 3:22 am, TheReckter <TheReck...@gmail.comwrote:
Hello, I tried uploading a file via the following method, however it
does not work, I was wondering what I did wrong as I can not see it.

form.html
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" id="file" />
<input type="hidden" value="hey" id="joe" />
<input id="submit" type="submit" value="Upload" />
</form>

upload.php
<?php
print_r($_FILES);
?>
More than likely you will need to set the MAX_FILE_SIZE in your HTML
form to allow you to upload the file. Make sure you add this prior to
the file input field, and the value is in bytes so 1024 bytes is equal
to 1KB and 1048576 bytes is equal to 1MB. Also for the file input
field make sure you use name instead of id:

<form action="upload.php" method="post" enctype="multipart/form-
data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<input type="file" name="file" />
<input id="submit" type="submit" value="Upload" />
</form

Hope that this helps.
Jun 7 '07 #2
More than likely you will need to set the MAX_FILE_SIZE in your HTML
form to allow you to upload the file. Make sure you add this prior to
the file input field, and the value is in bytes so 1024 bytes is equal
to 1KB and 1048576 bytes is equal to 1MB. Also for the file input
field make sure you use name instead of id:

<form action="upload.php" method="post" enctype="multipart/form-
data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<input type="file" name="file" />
<input type="submit" name="submit" value="Upload" />
</form

Hope that this helps you out.

Jun 7 '07 #3
More than likely you will need to set the MAX_FILE_SIZE in your HTML
form to allow you to upload the file. Make sure you add this prior to
the file input field, and the value is in bytes so 1024 bytes is equal
to 1KB and 1048576 bytes is equal to 1MB. Also for the file input
field make sure you use name instead of id:

<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<input type="file" name="file" />
<input id="submit" type="submit" value="Upload" />
</form

Hope that this helps.

-Jacob

Jun 7 '07 #4
Rik
On Thu, 07 Jun 2007 10:08:29 +0200, <Ja*****@gmail.comwrote:
More than likely you will need to set the MAX_FILE_SIZE in your HTML
form to allow you to upload the file.
Nope, I never do that, all my file-uploads work.
Also for the file input
field make sure you use name instead of id:
Or both a name & id, I think the lack of a name could very well be the
problem indeed.

--
Rik Wasmus
Jun 7 '07 #5
Rik wrote:
Or both a name & id, I think the lack of a name could very well be the
problem indeed.
Indeed -- form fields want names.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 103 days, 20:22.]

URLs in demiblog
http://tobyinkster.co.uk/blog/2007/05/31/demiblog-urls/
Jun 7 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: ok | last post by:
Hello, Q: How do I get image width and height before uploading an image? This because, I want to restrict people uploading huge files. Thanks in advance
6
by: Chamomile | last post by:
can anyone point me to some straightforward information on file uploading without using an html form? That is, direcly from within a php script. if I know the local path etc. to a particular...
5
by: Kevin Ollivier | last post by:
Hi all, I've come across a problem that has me stumped, and I thought I'd send a message to the gurus to see if this makes sense to anyone else. =) Basically, I'm trying to upload a series of...
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: Jason Chu | last post by:
I've written a file uploading part of my application using the IHttpModule. So now, I don't have the memory problem of uploading something big. Problem: I can't find which function I have to...
3
by: Carlos | last post by:
Hello Forum, I would appreciate it if you could recommend settings to use auto-vacuum in my version 7.4 database. I am uploading several thousands records in the database at a rate of ~1 second...
3
ganesanji
by: ganesanji | last post by:
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...
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...
3
by: muziburrehaman | last post by:
i am looking for code in php to upload the 1 gb files. any one can please help me by sending the code....
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: 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
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:
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
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
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
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...
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.