473,320 Members | 2,133 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,320 software developers and data experts.

uploading a pdf

I'm trying to upload a pdf file using the $_FILES built in array

It gets stalled at this point and displays the echo

if(!ereg("image",$_FILES['pix']['type']))
{
echo "<b>File is not a picture. Please try another
file.</b><br>";
include("illustup.inc");
exit();

This is the content of the $_FILES array
Array ( [name] => 000.pdf [type] => application/pdf [tmp_name] =>
C:\PHP\uploadtemp\php2D.tmp [error] => 0 [size] => 26596 )

is it the 'type' thats wrong or the "image", I'm assuming I'm missing
something in the mime type.

If I try to load a gif file using the same script, it works fine.

Thanks in anticipation

Stephen
Feb 27 '06 #1
3 1704
"Stephen Preston" <st*************@btconnect.com> wrote in message
news:dt**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
I'm trying to upload a pdf file using the $_FILES built in array

It gets stalled at this point and displays the echo

if(!ereg("image",$_FILES['pix']['type']))
{
echo "<b>File is not a picture. Please try another
file.</b><br>";
include("illustup.inc");
exit();

This is the content of the $_FILES array
Array ( [name] => 000.pdf [type] => application/pdf [tmp_name] =>
C:\PHP\uploadtemp\php2D.tmp [error] => 0 [size] => 26596 )

is it the 'type' thats wrong or the "image", I'm assuming I'm missing
something in the mime type.

If I try to load a gif file using the same script, it works fine.

Either "image" doesn't match "application/pdf" or the Gods of Php just hate
you. I'm guessing the former.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
Feb 27 '06 #2
Ofcourse it won't work. The scipt says in pseudo code, "if file type is
not image type (image/png, image/jpeg, image/gif, etc.) then echo file
is not a picture". Well, when you submit a pdf the file type is
application/pdf just like it says in the $_FILES array. If you want it
to work with pdf files then you'll need to remove this checking code.

Feb 27 '06 #3
d
"samudasu" <sa******@hotmail.com> wrote in message
news:11**********************@t39g2000cwt.googlegr oups.com...
Ofcourse it won't work. The scipt says in pseudo code, "if file type is
not image type (image/png, image/jpeg, image/gif, etc.) then echo file
is not a picture". Well, when you submit a pdf the file type is
application/pdf just like it says in the $_FILES array. If you want it
to work with pdf files then you'll need to remove this checking code.


Or, more logically, adapt the code to check for PDF files and not images :)
Feb 28 '06 #4

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
4
by: dickiedyce | last post by:
Hi there. I've spent the weekend getting ever more frustrated, trying to get an upload file function working on a website. The site is hosted by a company called oneandone. They're using PHP...
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.