Google Cloud Storage : PUT Object vs POST Object to upload file.? - google-cloud-storage

Can any one please explain me what is main difference between PUT Object vs POST Object to upload file.
What are advantages and disadvantages of using each ??
Thanks.

Use POST if you cannot set the Authorization header -- generally because you are uploading with an HTML form.
Use PUT for everything else.

Related

How to get serverside file uploading progress in Perfect

I'm trying to create a web page using Perfect(perfect.org), Where users will browse and upload files. Can anyone tell me how can I get the progress of file upload?
perfect.org-fileUploads
Refer above link and Do as-usual concept following in HTML-JS-PHP or HTML-JS-JSP or other programming
In other words
you can receive response status in percentage from server-side and display it to client or put loder while uploading the file
Thank you
Before an official solution released from PerfectlySoft Inc. for this feature request, you could try splitting the file into small pieces and upload them one by one, then merge them back to the server - since there is no such an industrial standard to apply, all other web servers either provide different solutions or simply stay away from it.

SLIM API - Offer Files to Download

I am using Slim API for my Project. I want to offer Files for Download (Mostly PDF files). I found several Ways sending out a public link to the file, which i dont want. I also found an Middleware for the Version 2.4 of Slim, but I am using 3.x.
I just want to access the Route e.g. /downloads/version/2183
And the a Downlod with this certain File ID should start. I have a Path to the File on the Server in a variable available.
The Basic Idea behind is different restrictions, which user can download the file - but i can do that myself - the problem where I am stuck is, how to bring the Download over the Route to the Clients Browser
Does anyone know how to achieve this?
Cheers,
Niklas
This is actually very easy.
Set the Proper Headers for the file on the Response Object
Read the contents of the file into the body of the Response Object
$app->get('/my/file', function ($req, $res, $args) {
return $res->withHeader('Content-Type', 'application/octet-stream')
->withHeader('Content-Disposition', 'attachment')
->write(file_get_contents("file.txt"));
});

How can i browse file without uploading in GXT?

i'm beginner with GXT and i'm wondering if there is a way to parse a file and extract some informations without uploading it.
i created a formpanel that contains an uploadFile form but i don't know waht's next, how to get the complete path of the file so i can read/write with java io or how to retrieve the file or is there an alternatif solution, thank you.
Best Regards.
You can do it in some modern browsers using bleeding edge HTML5 apis for which you would need to use GWT JSNI code. There are no api's from GWT team as is.
HTML5 FileReader
FileReader includes four options for reading a file, asynchronously:
FileReader.readAsBinaryString(Blob|File) - The result property will contain the file/blob's data as a binary string.
FileReader.readAsText(Blob|File, opt_encoding) - The result property will contain the file/blob's data as a text string.
FileReader.readAsDataURL(Blob|File) - The result property will contain the file/blob's data encoded as a data URL.
FileReader.readAsArrayBuffer(Blob|File) - The result property will contain the file/blob's data as an ArrayBuffer object.
Example of GWT wrapper over these -
https://github.com/bradrydzewski/gwt-filesystem
You can read about it more from here - How to retrieve file from GWT FileUpload component?
IMHO you cannot read it .
Due to security reasons javascript(gwt) doesn't have access to the system drives files.
http://en.wikipedia.org/wiki/JavaScript#Security
see Opening a file in local file system in javascript
In order to get the file you need to make a server call.
Instead you can do your validation server side and throw proper messages to user.
P.S : i am not considering modern browser concept.What happens if someone opened in other than so called modern browsers?? Will the programm runs same?? Its always better to do server side validation..

how to get data from wcf service using WCDL2OBJC

hi i got project files using WCDL2OBJC, and included it in my project.
but i don't know how to give inputs and get data, i am blank here can not move forward.
were as my url:
[http://parentportal.technologyorg.com/ParentPortal.svc?wsdl][1]
and i want to pass the parameter studentID='E6A83233-7D7F-49AF-B54E-375BBF3E3E59' to this url and get the out put in IBAction from the files of WSDL2OBJC.
can any one have some examples or source code to do this.
i have #class GetSchoolEvents, which is my method to get data in WCDL2OBJC file. how to access this and get data?
On the WSDL2OBJC pages you can find some samples how you can use the generated code. http://code.google.com/p/wsdl2objc/wiki/UsageInstructions
Just create a ..OperationRequest object and set properties for the variables

Processing Non-Well-Formed HTML with DOM

I have got a HTML which has obtained from a web site's source code. Im sending data with post method from my page to the web site, and the response is source code. I need some text in the source.
The document is non-well-formed. So, i can not use DOM, and i can not separate tag and data with DOM.
How can i separate tag and data, and how can i get the only data?
I'm using PHP.
Thanks.
I found something about getting data from html source code. I said in question, im using PHP.
I will use preg_match_all function and regular expression. Hopefully, i can overcome ;)
Thx to all who interested ;)