Adding php code to renaming file while/ after uploading -
i beginner php , learning ways around it. know functions nil working out me, making many mistakes. if please help. below part of code of image uploading function, need add together function renames file replacing spaces hyphen (-) [after / while uploading of image file)
if(isset($input['pic'])){ if(isset($input['img_url']) && $input['img_url'] != ''){ input['pic_url'] = imagehandler::uploadimage($input['img_url'], 'images', helper::slugify($input['title']), 'url'); } else if(isset($input['pic_url'])){ $input['pic_url'] = imagehandler::uploadimage(input::file('pic_url'), 'images'); $input['pic'] = 1; }
thanks
eb
first of use:
if (!empty($input['img_url'])) { ... }
instead of..
if (isset($input['img_url']) && $input['img_url'] != '') { ... }
as sec please create sure before posting question, if posted info necessary reply question. example, in code you're using imagehandler::uploadimage() it's not clear class it's function does. altho can guess parameters are. like..?
imagehandler::uploadimage($file, $folder, $name, $type);
anyway i'm not sure, if i'm right seek modify thrid parameter $name needs.
not bad mention, happens after file has been uploaded temporary directory on server after completion moved selected directory choosen filename.
php image-uploading file-rename
No comments:
Post a Comment