Re: PHP file upload unexpected error - file too large?
From: Erwin Moller (since_humans_read_this_I_am_spammed_too_much_at_spamyourself.com)
Date: 02/07/05
- Next message: Giulio Neri: "Re: PHP file upload unexpected error - file too large?"
- Previous message: Erwin Moller: "Re: preventing system crashes"
- In reply to: Giulio Neri: "PHP file upload unexpected error - file too large?"
- Next in thread: Giulio Neri: "Re: PHP file upload unexpected error - file too large?"
- Reply: Giulio Neri: "Re: PHP file upload unexpected error - file too large?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 07 Feb 2005 15:02:39 +0100
Giulio Neri wrote:
> Hi,
> I have a short basic script to upload files. It works fine with small
> files, but with longer files it gets stuck.
>
> Here's the fragment, the input file is loaded in "$file" from an HTML form
> as usual.
>
> ...
> $img_str = fread(fopen($file, "r"), filesize($file));
> $data = addslashes($img_str);
> // --------------------- up to here the execution is correct and fast (<1
> second)
>
> $sql="INSERT INTO $table (".
> " file_name,".
> " file_type,".
> " file_size,".
> " bin_data)".
> " VALUES (".
> " '$file_name',".
> " '$file_type',".
> " '$file_size',".
> " '$data')";
Are you aware that the query is very strange?
Since you put ' instead of " around stringliterals, the SQL you produce
might differ somewhat from what you expect.
Always try:
echo $sql;
before posting to a newsgroup. :P
You will have something like this:
INSERT INTO sometable (file_name,file_type,file_size,bin_data)
VALUES
('$file_name', '$file_type' etc. etc)
instead of the expected VALUES for the vars you use.
Check your ' and "
Regards,
Erwin Moller
> // --------------------- it gets stuck
> here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> mysql_query($sql) or die ("SQL error ..$sql");
>
> I have already set the php.ini variables as follows:
> memory_limit = 16M
> upload_max_filesize = 6M
>
> I also checked the execution time to max_execution_time = 300 (even though
> I don't believe it should be necessary).
> The server is a P4 1.8 GHz, 256MB RAM
>
> Any suggestion? Am I missing out something?
>
> Thanks in advance,
> G.
- Next message: Giulio Neri: "Re: PHP file upload unexpected error - file too large?"
- Previous message: Erwin Moller: "Re: preventing system crashes"
- In reply to: Giulio Neri: "PHP file upload unexpected error - file too large?"
- Next in thread: Giulio Neri: "Re: PHP file upload unexpected error - file too large?"
- Reply: Giulio Neri: "Re: PHP file upload unexpected error - file too large?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|