Title: files.php error
Last modified: November 20, 2020

---

# files.php error

 *  Resolved [troypouliot](https://wordpress.org/support/users/troypouliot/)
 * (@troypouliot)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/)
 * Hi
 * I have a customer that is getting an error when trying to checkout with photos
   uploaded. This is using the image cropper input type.
 * The error is;
    **rename(/home/customer/www/talkinghands3d.com/public_html/wp-
   content/uploads/ppom_files/,/home/customer/www/talkinghands3d.com/public_html/
   wp-content/uploads/ppom_files/confirmed/1361/1173-): Invalid argument in /home/
   customer/www/talkinghands3d.com/public_html/wp-content/plugins/woocommerce-product-
   addon/inc/files.php on line 384**
 * The section of code from the files.php file is;
 *     ```
       	// Check if file not yet moved to confirm then move it.
       	if( file_exists($base_dir_path) ) {
       		if(rename ( $base_dir_path, $confirmed_dir_path.$file_name)) {
       			$file_download_url_found = $ppom_dir_url .'confirmed/' .$order_id .'/' . $file_name;
       		}
       	} else if( file_exists($confirmed_dir_path.$file_name) ) {
       		$file_download_url_found = $ppom_dir_url .'confirmed/' .$order_id .'/' . $file_name;
       	} else if( file_exists($edits_dir_path) ) {
       		$file_download_url_found = $ppom_dir_url . 'edits/' . $file_name;
       	}
   
       	return apply_filters('ppom_file_download_url', $file_download_url_found, $file_name);
       ```
   
 * Can you please see if there is a solution so that I can continue to take orders?
 * Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffiles-php-error-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [N-Media](https://wordpress.org/support/users/nmedia/)
 * (@nmedia)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13691911)
 * Hi [@troypouliot](https://wordpress.org/support/users/troypouliot/),
 * ok let me see, the only specific customer getting this issue?
 *  Thread Starter [troypouliot](https://wordpress.org/support/users/troypouliot/)
 * (@troypouliot)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13691937)
 * Yes, so far. This is a new product and this is only the 2nd customer to place
   an order. The 1st customer did not have this issue. I’ve tested placing orders
   on both desktop and mobile and can’t get the error.
 * I’m trying to get more info from the customer on the file specifics for which
   they uploaded (file name, size).
 * Along those lines, are there any restrictions or limitation on file names (characters,
   length) for file uploads that could cause this error?
 *  Thread Starter [troypouliot](https://wordpress.org/support/users/troypouliot/)
 * (@troypouliot)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13691954)
 * Also, please see image below of the previously uplaoded image files thru the 
   image cropper input type.
    Does PPOM assign the random file names like you see
   below? Or is this the Optimole optimization plugin doing that? [PPOM uploaded file names](https://talkinghands3d.com/wp-content/uploads/2020/11/ppom-file-names.jpg)
    -  This reply was modified 5 years, 6 months ago by [troypouliot](https://wordpress.org/support/users/troypouliot/).
 *  Thread Starter [troypouliot](https://wordpress.org/support/users/troypouliot/)
 * (@troypouliot)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13692945)
 * Ok, so I’ve done some more troubleshooting. Luckily the customer in this case
   is a family member.
 * The error message comes up and the checkout fails if the user tries to checkout
   with more than 1 item.
    If only 1 item is purchased at a time then it works fine.
   Please help
 *  [N-Media](https://wordpress.org/support/users/nmedia/)
 * (@nmedia)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13702847)
 * Hi,
 * you mean two products in a cart with different cropped images?
 *  Thread Starter [troypouliot](https://wordpress.org/support/users/troypouliot/)
 * (@troypouliot)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13703011)
 * Correct
 *  Thread Starter [troypouliot](https://wordpress.org/support/users/troypouliot/)
 * (@troypouliot)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13704572)
 * I think I’m starting to narrow down what is going on.
    A lot of times now I get
   this error when trying to checkout “SyntaxError: Unexpected token < in JSON at
   position 0”
 * When I look at the chrome dev tools there is a resource that returns a 404 error.
   
   I think this is what is throwing the JSON error.
 * I noticed that after adding my product to the cart there are 2 extra icons under
   the original photo and the cropped photo. You can see that one of them is the
   broken resource.
 * What are these and how can they be removed?
 * Please see image here –
    [https://talkinghands3d.com/wp-content/uploads/2020/11/JSON-error.jpg](https://talkinghands3d.com/wp-content/uploads/2020/11/JSON-error.jpg)
 *  Thread Starter [troypouliot](https://wordpress.org/support/users/troypouliot/)
 * (@troypouliot)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13705532)
 * Sorry to keep adding to this but I have found what I think is causing the error
   and this is something that should be added to the image cropper tool.
 * In the image cropper tool, you can add different “options” in the form of “viewport
   sizes”
    The problem is that you cannot set any of these options as a preselected
   or default option. The user can upload an image and add the item to the cart 
   without ever selecting one of the options I have created. When this happens the
   syntax error appears. HOPEFULLY this is what is causing it.
 * Can we get the option to have one of the options preselected? Or make the options
   be required? Or, not show the cropping window UNTIL an option is selected.
 * Something similar to the image field where there is the “selected image” field
   where we can define one of the images to be pre selected.
 *  [N-Media](https://wordpress.org/support/users/nmedia/)
 * (@nmedia)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13707854)
 * Hi [@troypouliot](https://wordpress.org/support/users/troypouliot/),
 * Ok, thanks for sharing it. Now have fixed this issue in version 21.2. And we 
   also added the option for `first option` and `Default selected` 🙂
 * It will be released soon.
 *  Thread Starter [troypouliot](https://wordpress.org/support/users/troypouliot/)
 * (@troypouliot)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13750086)
 * How is this update coming? I really need to have this issue fixed. Have any suggestions
   for another image cropping tool to replace this?
 *  [N-Media](https://wordpress.org/support/users/nmedia/)
 * (@nmedia)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13754611)
 * It will be released in a few days, but if you really need it you can ask our 
   support via email to get the download link.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘files.php error’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-product-addon/assets/icon-256x256.gif?rev=3186763)
 * [PPOM - Product Addons & Custom Fields for WooCommerce](https://wordpress.org/plugins/woocommerce-product-addon/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-product-addon/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-product-addon/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-product-addon/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-product-addon/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-product-addon/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [N-Media](https://wordpress.org/support/users/nmedia/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/files-php-error-2/#post-13754611)
 * Status: resolved