Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Juli3n  
#1 Posted : Friday, May 23, 2008 9:23:55 PM(UTC)
Juli3n

Rank: Member

Groups: Member
Joined: 3/22/2008(UTC)
Posts: 13

Hello,

I'm trying to use Image uploader with multiple upload dir. A new dir is creat when a new upload is done. But i want to recover my upload dir and to get it in the url. A sort of :

Quote:
iu.addParam("RedirectUrl", "index.php?p=galerie&rep=[fileName]")


Any ideas ?
Thanks and sorry for my English.
Eugene Kosmin  
#2 Posted : Sunday, May 25, 2008 12:14:29 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Hi,

Do you want to generate some folder name in your upload script and redirect user there after upload, right? I hope this small snippet will be helpful:

Code:
  <script language="javascript">
        function ImageUploader_AfterUpload(Page)
        {
            window.location = Page + "/RequestDump.txt";
        }

        var iu = new ImageUploaderWriter("ImageUploader", 800, 400);

        iu.addParam("Action", "Upload.aspx");

        iu.addParam("ShowDebugWindow", "true");

        iu.addEventListener("AfterUpload", "ImageUploader_AfterUpload");

        iu.writeHtml();
    </script>


Server code:
Code:
void Page_Load()
{
    String folderName = System.Guid.NewGuid().ToString();

    System.IO.Directory.CreateDirectory(Server.MapPath(folderName));
    
    Request.SaveAs(Server.MapPath(folderName + "/RequestDump.txt"), true);

    Response.Write(folderName);
}

File Attachment(s):
RedirectSnippet.zip (6kb) downloaded 2 time(s).
Best regards,
Eugene Kosmin
The Aurigma Development Team
Juli3n  
#3 Posted : Sunday, May 25, 2008 8:52:12 PM(UTC)
Juli3n

Rank: Member

Groups: Member
Joined: 3/22/2008(UTC)
Posts: 13

Hello,

Thanks for your reply, yes iam trying to do this. I use PHP langage how can I adapt the snippet ?

Edit : I add a function ImageUploader1_AfterUpload in my page and i create a text file who contains the new directory name. I'm trying to obtain it in my function.

Edited by user Monday, May 26, 2008 12:48:42 AM(UTC)  | Reason: Not specified

Juli3n  
#4 Posted : Monday, May 26, 2008 1:04:13 AM(UTC)
Juli3n

Rank: Member

Groups: Member
Joined: 3/22/2008(UTC)
Posts: 13

It's ok !!

Is use that :

In index.php file :

Quote:
<?php
//Creat random nomber
$rep = rand();
?>
...
//Configure URL files are uploaded to.
iu.addParam("Action", "upload/upload.php?rep=<?php echo $rep; ?>")
...
//Configure URL where to redirect after upload.
iu.addParam("RedirectUrl", "index.php?p=galerie&rep=<?php echo $rep; ?>")


In upload.php file :
Quote:
$rand = $_GET['rep'];
mkdir ("Gallery/".$rand, 0600);
$galleryPath = "Gallery/".$rand."/";
$absGalleryPath = realpath($galleryPath) . "/";
mkdir($galleryPath."Thumbnails", 0600);
$absThumbnailsPath = realpath($galleryPath . "Thumbnails/") . "/";


Thank you !
Eugene Kosmin  
#5 Posted : Tuesday, May 27, 2008 11:30:36 AM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
You are welcome.
Best regards,
Eugene Kosmin
The Aurigma Development Team
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.