How can I stop file writing ( upload form remote url ) when file size exceeds 500KB ?
I am using following code to upload a remote file
require 'open-uri'
open('temp/demo.doc', 'wb') do |file|
file << open('http://ift.tt/1LJxj3W').read
end
this code is working properly and I am able to get files in temp folder. Now I want if filesize exceeds 500KB then it should stop writing file. In other words I want only 500KB of file if it is more than 500KB
Aucun commentaire:
Enregistrer un commentaire