vxda Posted April 13, 2014 Share Posted April 13, 2014 Hion my site users can post new articles, and withing them upload images i made this: $pic= new WireUpload('fileUploadInput'); $pic->setMaxFiles(1); $pic->setOverwrite(false); $pic->setDestinationPath($upload_path); $pic->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); $files = $pic->execute(); if(!count($files)) { $pic->error("Sorry, but you need to add a photo!"); return false; } The above works with <input type="file"/> Is there a way to upload files thru url ? exaple :<input type="text" value="http://processwire.com/site/assets/files/1/fields.jpg"> Link to comment Share on other sites More sharing options...
Pete Posted April 13, 2014 Share Posted April 13, 2014 Can you not just do this when they submit the text field containing the URL? $pic->add($input->post->your-text-field); Not sure it works with URLs but that's the way to test it 1 Link to comment Share on other sites More sharing options...
horst Posted April 14, 2014 Share Posted April 14, 2014 You can simply use a textfield for an URL and also you do not need to use the WireUpload if you finally want to use the image(s) within an pw images field. For that you simply can use $page->images->add('URL_from_text'); But remember to not use $input->post->your-text-field without first validating it. You need to make sure you only got an URL! 1 Link to comment Share on other sites More sharing options...
vxda Posted April 14, 2014 Author Share Posted April 14, 2014 $page->images->add('URL_from_text'); That looks easy ill check it out later today, thank you Link to comment Share on other sites More sharing options...
vxda Posted April 14, 2014 Author Share Posted April 14, 2014 Another question: in my form i got <input type="text" name="url"/> now in php i want to check if this is image, if it is attatch it to fieldinput image_url,but if its url to youtube or vimeo attatch it to textarea video_url.im using this plugin for vids:http://modules.processwire.com/modules/textformatter-video-embed/ Is there a way to check if the link is a img and its not broken ? if this img acculy exsist ? Link to comment Share on other sites More sharing options...
Soma Posted April 14, 2014 Share Posted April 14, 2014 Sure, ever heard of google? That thing that knows all? http://bit.ly/1p1YWuB 3 Link to comment Share on other sites More sharing options...
vxda Posted April 14, 2014 Author Share Posted April 14, 2014 Sure, ever heard of google? That thing that knows all? http://bit.ly/1p1YWuB HAHA <3 LOVE IT ! ty Soma Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now