|
|
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.
|
|
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
|
|
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.
|
|
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 !
|
|
Rank: Advanced Member Groups: Member
Joined: 9/19/2006 Posts: 351 Points: 174
|
You are welcome.
Best regards, Eugene Kosmin.
Aurigma Development Team
|
|
|
Guest |