Log in

View Full Version : php image



hemi
09-02-2009, 11:42 AM
i can upload image but wht my problem is if there are any gaps between the name of image (ex:summer hiils.jpeg) it is not showing the image when iam calling from database, the other names works properly like(me.jpeg,single.jpeg) please help me out as quick ac possibile


2) when i uploaded my site on server iam getting a error at the end of page
--------------------------------------------------------
Error in my_thread_global_end(): 1 threads didn't exit
----------------------------------------------------------

how to solve it. URGENT PLEASE

Nile
09-02-2009, 11:48 AM
In the database try this:

summber%20hiils.jpeg


Good luck

hemi
09-02-2009, 12:03 PM
that is possible ,wht if my uploading file name is having gaps

JShor
09-02-2009, 03:25 PM
you can rename your file in both the database and the actual file itself, by replacing spaces " " with underscores "_". I do that myself.

For example, after uploading the file, use rename to rename file:


$file = $_POST['file'];

rename($file, str_replace(" ", "_", $file));


und when uploading to the database, do the same:



$_POST['file'];
$newImg = str_replace(" ", "_", $_POST['file']);

mysql_query("INSERT INTO images (img) VALUES('$newImg') ") or die(mysql_error());

Nile
09-02-2009, 11:50 PM
What do you mean "gaps?" Replace all of the spaces with %20. For example:
hi ,.php
Turns to:
hi%20%20.php

JShor
09-03-2009, 12:36 AM
She means when she's uploading, the file name that gets inputted into the database has spaces. But like said before, you can avoid that by replacing spaces w/underscores. [better].

Now, if you want a much faster solution to the problem, you can just replace spaces w/%20 when calling the file from the database.