When added with images, the name <name> <format> is assigned, and it must be <name>. <Format> Here is a piece of code responsible for this:
$dir='/bol/img/'; $format="jpeg"; $basename=basename($file); $up_file=$dir.'.'.$basename; echo ($up_file); if (is_uploaded_file($_FILES['myfile']['tmp_name'])) { $n=mt_rand(0,997); $file_path=$dir.$n.$format; if (!file_exists($file_path)) {
And one more question: how to correctly specify the path in $ dir = '/ bol / img /'; Otherwise, he writes an error:
localhost/bol/img/.5VJE21LC.jpglocalhost/bol/img/791jpeg Warning: move_uploaded_file(localhost/bol/img/791jpeg) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\xampplite\htdocs\bol\admin\img.php on line 45 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\xampplite\tmp\php5AC3.tmp' to 'localhost/bol/img/791jpeg' in C:\xampplite\htdocs\bol\admin\img.php on line 45
If at all the full path of this folder is C:\xampplite\htdocs\bol\img