Skip to main content
Home Forums Silverlight Programming Programming with .NET - General copy a file in temp location!
12 replies. Latest Post by joji777 on June 11, 2009.
(0)
joji777
Member
84 points
218 Posts
06-10-2009 5:40 PM |
Hi,
I can have file open dialoge in silverlight. I want to copy the selected file at another temporary location on the client's hard disk. How is that possible. I tried Openfiledialoge.copyto(), but that give me access is not allowed exception.
how much max temporary location i can use, as i am allowing client to select almost more than 50 files and each file size can be up to 10mb, which means almost 500mb data I want to copy in clients temporary location, although i would like to delete it later if I am allowed to do that in my code.
Any help plz ??
Regards
ken tucker
All-Star
16298 points
2,485 Posts
06-10-2009 5:56 PM |
The only place you can save something to the users hard drive without there interaction is isolated storage
ksleung
Contributor
5366 points
1,028 Posts
06-10-2009 5:58 PM |
I don't think you can do that.
06-10-2009 6:55 PM |
hi
I found answers here
http://silverlight.net/forums/t/12590.aspx
http://www.switchonthecode.com/tutorials/silverlight-tutorial-using-isolated-storage
06-10-2009 7:01 PM |
BTW if you gonna use IsolatedStorage, keep in mind that you can only increase the quota, not decrease it.
06-10-2009 7:09 PM |
yeah, I can only increase the quota but then I can delete the files or directories so I can have free space again.
But I am still unable to find what is maximum limit to increase the quota, as I want to researve around 500 Mb not all at once but it will increase 12Mb (aprox) with each user request.
Now i am using method IncreaseQuotaTo but I get exception here and it is not increasing the quota, I just ask a quota for double size then my filebuffer length which is around 10Mb.
so questions are still open, what is maximum limit to increase quota ?
why i am getting this exception ??
06-10-2009 7:16 PM |
I don't think there is a limit. In my current application I increase it to 500MB and there is no problem. Make sure you pass in the right number. The parameter you specify should be strictly greater than the current quota.
06-10-2009 7:25 PM |
well i am giving greater number than previous quota alloted but i still see that exception, could it be the user permission by system administrator, can you please share that piece of code with me which is increasing quote up to 500 MB.
06-10-2009 8:10 PM |
This is what I did (quoted from the source code verbatim):
System.IO.IsolatedStorage.IsolatedStorageFile store = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication(); if (store.Quota < 1024 * 1024 * 500) store.IncreaseQuotaTo(1024 * 1024 * 500);
One more thing to pay attention to: you can only call this function in response to a button click event. One possibility is to dim your page, explain to the user why this is needed, and ask him to choose between the red pill or the blue pill...
06-11-2009 2:41 AM |
i am trying to do exactly the same thing, but it is not increasing the quota. any clue what ia m doing wrong here, i am doing it on button click event. and i am trying to store file in MyDir directory
{
isolatedStorageFile.IncreaseQuotaTo(1024 * 1024 * 500);
}
06-11-2009 2:48 AM |
looks right to me. One more thing to check... right click on the app to bring up Silverlight Configuration. Go to Application Storage. Is "Enable application storage" checked? How about the amount of memory allocated according to the report?
06-11-2009 4:32 AM |
enable storage application checkbox is checked. I also followed this video.
http://silverlight.net/learn/learnvideo.aspx?video=65677
nothing works, it is still not increasing the quota :(
06-11-2009 7:41 AM |
ok finally I found the problem.
On button click I am creating OpenFileDialouge and showing it for user to select a file and after user selection i creat isolated storage and try to increase the quota. I changed the sequence, right after button click first i get isolated storage and increase its quota then i perform open file dialogue related work and it works fine.