2

I have a form (code below) that allows a user to upload an image but I would also like them to be able to insert a URL and the image will be fetched and uploaded. What could I add this form to do this? Thanks

<?php } if ($settings['usp_images'] == 'show') { ?>
            <?php if($settings['max-images'] !== 0) { ?>
            <li class="usp_images">
                <label for="user-submitted-image" class="usp_label"><?php _e('Upload an Image'); ?></label>
                <div id="usp_upload-message"><?php echo $settings['upload-message']; ?></div>
                <div>
                    <?php 
                    if($settings['min-images'] < 1) {
                        $numberImages = 1;
                    } else {
                        $numberImages = $settings['min-images'];
                    }
                    for($i = 0; $i < $numberImages; $i++) { ?>
                    <input class="usp_input usp_clone" type="file" size="25" id="user-submitted-image" name="user-submitted-image[]" />
                    <?php } ?>
0

2 Answers 2

2

Here's a write-up on how to do it: http://codestips.com/php-save-image-from-url/

Sign up to request clarification or add additional context in comments.

1 Comment

Looks like I need to hire someone to add it to this form. Where should one go fore speedy service?
0

It doesn't make sense for the browser to be doing that. Send the URL to the server, and let the server retrieve the image from the URL.

The PHP script can use curl or file_get_contents to download the image from the url, or issue an error in case of bad URL.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.