mrheff Posted March 10, 2007 Share Posted March 10, 2007 hey guys..... pottering away and got a lil stuck and wodered if you could help.... I would like to show a users uploaded files as a clikkable thumbnail which when pressed renames(moves the image into its new directory) I have gotten as far as making them appear as thumbs that link to large images, I guess they need to link to something like Moveme.php which would say <?php $file = '$_GET('filename')'; $dir = '$_GET('direcotry')'; $newfile = '$directory''/''$file'; if (!rename($file, $newfile)) { echo "failed to copy $file...\n"; } ?> this is not working yet... so any idead would be much appreciated or if you have any other ideas i would love to hear them hopefully its my poor syntax more than anything. Getting the link to pass on the variables should be no trouble.... thanks guys!!! Quote Link to comment https://forums.phpfreaks.com/topic/42140-moving-a-file-to-a-directory-by-showing-clicking-a-thumbnail/ Share on other sites More sharing options...
per1os Posted March 10, 2007 Share Posted March 10, 2007 Why is $_GET encapsulated in single quotes? not necessary and is probably causing problems. <?php $file = $_GET['filename']; $dir = $_GET['direcotry']; ?> That may be half of your problem, where does that get you? If no where what errors are coming up? --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/42140-moving-a-file-to-a-directory-by-showing-clicking-a-thumbnail/#findComment-204403 Share on other sites More sharing options...
mrheff Posted March 10, 2007 Author Share Posted March 10, 2007 hi man thanks for hitting me back so quick, im still kinda figuring out the whole syntax thing ive got far to go.. that is very helpfull and ill edit accordingly....I found this maybe i can edit the delte command into the rename command... it currently deletes an image <? if(isset($_GET['delete'])){ $_GET['delete']=preg_replace('`[^a-z0-9-_.]`i','',$_GET['delete']); @unlink(dirname(__FILE__).'/pics/'.$_GET['delete']); } ?> and this is the part that deffers to it. created by a "for each $file" statement <? <a href="',$_SERVER['PHP_SELF'],'?delete=',$file,'">Delete Image</a>',"\n", ?> I think it should maybe look like this... <? if(isset($_GET['send'])){ $_GET['send']=preg_replace('`[^a-z0-9-_.]`i','',$_GET['send']); @unlink(dirname(__FILE__).'/pics/'.$_GET['delete']); } ?> but this bit I have no idea of the syntax for @unlink(dirname(__FILE__).'/pics/'.$_GET['delete']); I know it will be much different and really dont know where to start, maybe my orginal idea would be easier...... Quote Link to comment https://forums.phpfreaks.com/topic/42140-moving-a-file-to-a-directory-by-showing-clicking-a-thumbnail/#findComment-204416 Share on other sites More sharing options...
per1os Posted March 10, 2007 Share Posted March 10, 2007 Give it a try, see what happens. Thats all of the fun, trial and error. --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/42140-moving-a-file-to-a-directory-by-showing-clicking-a-thumbnail/#findComment-204419 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.