Is there a way to upload a file to a "File" field using either a direct upload ("Browse" button) or a URL input? I noticed that the built-in file field only support direct upload.


1 Answer 1


Yes, the built-in file field only support direct upload. For a URL input upload, you will need to develop a custom field type. It's possible with the cURL of PHP. Here I can share PHP code example how a remote file can be saved within a directory.

Example code:

$upload_dir_path = '/UPLOAD/DIRECTORY/PATH/';
$file_url = 'URL OF THE FILE';

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $file_url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$upload_file = curl_exec($ch);

file_put_contents($upload_dir_path, $upload_file);

I hope, you would be aware to develop an EE field type and above code example would be helpful for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.