Dynamic Upload Folder Name

Thread is closed for posting
4 posts, 1 answers
  1. bradley baker
    bradley baker avatar
    97 posts
    Member since:
    Aug 2009

    Posted 13 Nov 2009 Link to this post

    How would I make it so the upload folder is the numeric ID value of the inserted record?  IE in my PHP site I have the files being uploaded into a tmp folder which is then dynamically renamed to the ID value of the recored inserted.  So all the files are in 1 folder with the ID value of that record.

    ../HelpDesk/HelpDeskAttachments/1001   (1001 being the auto generated id from SQL)
  2. bradley baker
    bradley baker avatar
    97 posts
    Member since:
    Aug 2009

    Posted 17 Nov 2009 Link to this post

    No one has an idea?
  3. Answer
    Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 18 Nov 2009 Link to this post

    Hi bradley baker,

    Here is what you need to do: do not set the TargetFolder (nor the TargetPhysicalFolder) properties of the upload. Then, in the event handler of the submit button insert the record in your database and get the ID. Then create the folder with that name and use the SaveAs method of the UploadedFile object to save the file to that folder.

    You can check this help topic for more information.

    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    GOURVEZ JJ avatar
    55 posts
    Member since:
    Dec 2009

    Posted 16 Dec 2009 Link to this post


    thanks for your answer

    I don't find how to upload file with PHP script :(.

    I have an php script fonctionnaly but when the file is on my server it is corrumped.

    I only changed url service beacuse I don't see the modification to realise

    Do you have an example ?


Back to Top