Forums

Welcome Guest Search | Active Topics | Members

Get the upload dir Options
Juli3n
Posted: Saturday, May 24, 2008 5:23:55 AM
Rank: Member
Groups: Member

Joined: 3/22/2008
Posts: 13
Points: -58
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
Posted: Sunday, May 25, 2008 8:14:29 PM
Rank: Advanced Member
Groups: Member

Joined: 9/19/2006
Posts: 351
Points: 174
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.

Aurigma Development Team
Juli3n
Posted: Monday, May 26, 2008 4:52:12 AM
Rank: Member
Groups: Member

Joined: 3/22/2008
Posts: 13
Points: -58
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.
Juli3n
Posted: Monday, May 26, 2008 9:04:13 AM
Rank: Member
Groups: Member

Joined: 3/22/2008
Posts: 13
Points: -58
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
Posted: Tuesday, May 27, 2008 7:30:36 PM
Rank: Advanced Member
Groups: Member

Joined: 9/19/2006
Posts: 351
Points: 174
You are welcome.


Best regards,
Eugene Kosmin.

Aurigma Development Team
Users browsing this topic
Guest


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.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Yet Another Forum.net version 1.9.1.6 running under Cuyahoga.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.