开发者

image uploading and fetching problem

开发者 https://www.devze.com 2023-01-29 05:26 出处:网络
my image name is like this:-- demo 123.jpg can i save that image name demo 123 in database column. And in also in folder as demo 123.jpg

my image name is like this:-- demo 123.jpg

can i save that image name demo 123 in database column. And in also in folder as demo 123.jpg

when i am fetching with demo 123.jpg it can not find image name because..

peoblem开发者_开发问答 is space in name of image...

i dont want to replace space in image name with any character like _

can i do it without it.?


try this:

`demo 123.jpg`


What you need to do is make sure that when the image is saved, all the spaces are converted to - or _ using a regular expression like this

preg_replace('/\s/i', '-', 'demo 123.text');

This will make sure all spaces are converted to hyphens. Now save this name into your database and also use that name to rename the file when its uploaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消