Re: Unzip file and show it.
Posted: Thu Feb 28, 2013 1:46 am
Ok I renamed my pdf file as imagesApp and removed the .pdf extention and zipped it and then uploaded it to my server and also renamed a folder full of non decompressed pdf's as imagesApp and uploaded them to my web server one at a time.
I used the following code below exactly as presented in this thread and executed it from a button in the simulator. The imagesApp.zip file does get downloaded to the documents folder however it does not de compress and delete itself. I tried both the individual file and the folder.
Here is the code
on mouseup
downloadFiles
unZip
end mouseup
on downloadFiles
libUrlDownloadToFile "http://myservername.on-rev.com/Maps/magesApp.zip", specialfolderpath ("documents") & "/imagesApp.zip"
send unZip to me in 0 milliseconds
end downloadFiles
command unZip
put specialFolderPath("documents") & "/imagesApp.zip" into TempFile
put specialFolderPath("documents") & "/" into TargetFile
revZipOpenArchive TempFile, "read"
put RevZipEnumerateItems(TempFile) into tList
repeat for each line i in tList
if i = empty then
next repeat
end if
revZipExtractItemToFile TempFile, i, (TargetFile & i)
end repeat
revZipCloseArchive TempFile
delete file TempFile
end unZip
I use the code below to confirm that the zip file did get downloaded and that the compression did not take place with the code below
I use the code
on mouseUp
if the environment is mobile then
put specialFolderPath("documents") into tpath
set the defaultfolder to tpath -- so you can get the folder names
put the folders into tMyList -- get a list of folder names
put the files into tList -- a list of the file names
answer tList -- returns imagesApp.zip
answer tMyList -- returns one unrelated folder name that I have copied over on openstack
end if
end mouseUp
So what do you think? NOTE: the file i am trying to decompress is a .pdf file and the folder I would like to decompress is a folder holding non individually compressed pdf's and I have zipped the folder itself. I cant seem to decompress anything.
dave
I used the following code below exactly as presented in this thread and executed it from a button in the simulator. The imagesApp.zip file does get downloaded to the documents folder however it does not de compress and delete itself. I tried both the individual file and the folder.
Here is the code
on mouseup
downloadFiles
unZip
end mouseup
on downloadFiles
libUrlDownloadToFile "http://myservername.on-rev.com/Maps/magesApp.zip", specialfolderpath ("documents") & "/imagesApp.zip"
send unZip to me in 0 milliseconds
end downloadFiles
command unZip
put specialFolderPath("documents") & "/imagesApp.zip" into TempFile
put specialFolderPath("documents") & "/" into TargetFile
revZipOpenArchive TempFile, "read"
put RevZipEnumerateItems(TempFile) into tList
repeat for each line i in tList
if i = empty then
next repeat
end if
revZipExtractItemToFile TempFile, i, (TargetFile & i)
end repeat
revZipCloseArchive TempFile
delete file TempFile
end unZip
I use the code below to confirm that the zip file did get downloaded and that the compression did not take place with the code below
I use the code
on mouseUp
if the environment is mobile then
put specialFolderPath("documents") into tpath
set the defaultfolder to tpath -- so you can get the folder names
put the folders into tMyList -- get a list of folder names
put the files into tList -- a list of the file names
answer tList -- returns imagesApp.zip
answer tMyList -- returns one unrelated folder name that I have copied over on openstack
end if
end mouseUp
So what do you think? NOTE: the file i am trying to decompress is a .pdf file and the folder I would like to decompress is a folder holding non individually compressed pdf's and I have zipped the folder itself. I cant seem to decompress anything.
dave