Image from URL Copied to Cutenews Image Folder

Post your suggestions for the script here.

Postby eberswine » Sat Mar 06, 2010 4:36 pm

Look near line's 450-480 or so:

Look for the end of the form </form> and then paste in the <b>Remote upload</b>

Code: Select all
<img name="previewimage" width="100px" src="data/watermark/<?=$watermarks[0]; ?>" align="left" style="margin: 5px;">
   <? }
   else { echo $echo['emptyWatermark']; }
   ?>
   
   </td>
   </tr>
   </table>
   <br /></span>
   
     <input type="submit" value="<?=$echo['upload']; ?>">
</table>
</form>
//Start Remote Upload here
<b>Remote upload</b>
User avatar
eberswine
 
Posts: 289
Joined: Thu Apr 26, 2007 7:23 pm

Postby samiro » Sat Mar 06, 2010 4:52 pm

thank you alot :)
very usefull

but it dosnt meke thumbs
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby nam » Sat Mar 13, 2010 3:10 pm

This is a great and useful code, but it still needs some improvements:

If you enter a wrong URL, the following error will be dispalyed:

Code: Select all
Warning: copy(hh): failed to open stream: No such file or directory in /home/****/inc/mod/images.mdu  on line 550
File upload failed.


I changed the code a bit which now solves the above warning:

Code: Select all
<?php
if ($_GET[loadurl]){

$from = $_POST[from];
if (!is_array(@getimagesize($from)))
{
    echo 'Failed to open the URL.';
   } else{
        if($_POST[to] == "") {
           $to = basename("$from");
        } else $to = $_POST[to];
        if (!copy("$_POST[from]","$folder/$to")){
           echo 'File upload failed.';
        }
    }
}

?>


It also automatically overwrites if a file already exists, this can cause a big problem.

Also it should check to upload only image files (jpg, png, gif) and stop upload of any other kind of images.
User avatar
nam
 
Posts: 221
Joined: Sat Dec 23, 2006 9:10 pm

nice but...

Postby samiro » Sat Mar 13, 2010 10:27 pm

there is another thing.
this script can upload a file just to the "Main" directory....
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby Hawk » Sun Mar 14, 2010 10:42 pm

Is your upload folder correctly chmoded, to be able to upload, you need to set correct permissions for it (777 will work good).
User avatar
Hawk
 
Posts: 279
Joined: Tue Aug 29, 2006 9:00 pm

Postby samiro » Sun Mar 14, 2010 11:59 pm

Of course, I upload pictures into these folders every time.
But with this script - even if I'm in Folder X - It upload the picture into the "Main" folder.
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Previous

Return to Suggestions



Who is online

Users browsing this forum: No registered users and 0 guests

cron