Jump to content

moving a file to a directory by showing clicking a thumbnail


Recommended Posts

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!!!

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

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......

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.