Search
 
SCRIPT & CODE EXAMPLE
 

PHP

PHP how to skip file upload if file already exist

if(isset($_FILES["user_image"]) && (int)$_FILES["user_image"]['error']===0)
{
    $extension = explode('.', $_FILES['user_image']['name']);
    $new_name = rand() . '.' . $extension[1];
    $destination = '../upload/' . $new_name;
    move_uploaded_file($_FILES['user_image']['tmp_name'], $destination);
    return $new_name;
}
Comment

PREVIOUS NEXT
Code Example
Php :: twig global 
Php :: prevent cross site scripting php 
Php :: php opencart controller 
Php :: laravel download file from AWS s3 
Php :: php array_diff vs array_diff_assoc 
Php :: larvel still laod the local file location on production 
Php :: laravel migration softdelete 
Php :: installing php storm version 20 in ubuntu 
Php :: how return cutomize error text the firstOrFail laravel exeption 
Php :: how to get create table query preview in phpmyadmin 
Php :: show real number and not exponential form php 
Php :: Display a variable containing html in laravel 
Php :: user1263019 how to upload a file using php curl 
Php :: How to Allow Users to Delete a Post From the Front-End 
Php :: Determine the percentage of the file uploaded to the server using php 
Php :: how to disable auto prediction html input in laravel 
Php :: laravel app service provider why eloquent model error 
Php :: WordPress Creating “startupl” folder and Wrtting to .htaccess 
Php :: php print array key and value 
Php :: SymfonyComponentHttpKernelExceptionNotFoundHttpException: POST http://localhost/post 
Php :: eager loading set limit to relationship 
Php :: automatically create html page using php and mysql 
Php :: laravel child relation get max value 
Php :: expresions 
Php :: detect mobile device laravel 
Php :: what is post_class() 
Php :: unlink() in php 
Php :: prestashop get product id 
Php :: ERROR: Module mpm_event is enabled - cannot proceed due to conflicts. It needs to be disabled first! Considering conflict mpm_worker for mpm_prefork: ERROR: Could not enable dependency mpm_prefork for php7.2, aborting 
Php :: phpunit/phpunit[6.0.0, ..., 6.5.14] require php ^7.0 - your php version (8.0.0) does not satisfy that requirement. 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =