How to upload file through website, on mobile? - php

Is it possible to create a file/s upload system, on a mobile friendly website, that uploads the file from the mobile when it gets internet connection?
To put in a scenario: User X wants to upload 3 images on the website. X is outside, opens the website on this phone and selects the images he wants to upload. When he is about to start the upload, or has just started he looses internet connection. X then locks his phone, goes somewhere where there is internet and the file uploads continues and finishes. Is there a way to achieve something similar to this?
This is similar to Is there a browser file upload solution that can survive connection interruptions?
but the answers are over two years old. This question also doesn't talk about mobile, but I don't know if it matters with the file upload.
Sorry for the bad english and grammar
Regards

It is certainly possible. However I don't think a browser based solution will do. This has to do with both server and client side connections.
For example. In a traditional web server environment, the server will not keep a connection open when user looses its connectivity. When the user re-gains the connectivity the server may not know the state in which the client [or browser] is in ... so the client will need to communicate that state back to the server.
On the other hand the browser will also cease its connection irrespective of the fact whether its a mobile app or not.
I think you will need to supply an intelligent client , perhaps a Java based app to remember those issue and re-supply the broken session information to the server.
And just like that the server will need to be able to handle that .. though it can be an http server.

Related

Is there any solution to log if somebody get my website's pages with file_get_contents?

For example somebody get data from my website with file_get_contents, on his local computer, upload data to his DB and after upload this DB to a server?
Sorry for my bad English...
Thank you for your replay!
Your web server should log the requests whether they came via file_get_contents or any other way. You can check the logs to see if there is anything distinctive about these requests (like the IP they are coming from or the user agent string).
Once the information is downloaded, it is now out of the control of your server and so you will not be able to log if the data is uploaded to a DB or other server.

How can I know my php session information in dot net application?

I have developed a website in php-zend with SQL server 2008r2 in which we can create requests. I am building an add-in for Outlook in asp.net with C# to create a request directly from email also.
But at the time of request creation from Outlook, I want to know whether that person is already logged into the website or not. If not then he needs to log into the website first, then only he can create a request from Outlook.
So basically I want to synchronize my website and the Outlook add-in application. I searched for active directory also, but could not get any idea how to achieve that.
Can anyone help me?
Thanks a lot in advance,
Mausami
It's not really designed to do this. You would need to look up the phpsessid value in the cookie set for your website on the local computer.
That's basically impossible because,
Every browser and OS store cookies differently, checking all the major browser cookie stores would be cumbersome and slow
If the browser is open when you're add in runs, the cookies will probably have an exclusive lock on them
Private browsing does not save cookie values to disk
Use authentication within you're plugin instead.

iPhone app-communicating with servers

Ok. I am a bit of a new developer and haven't done much work with networking (in general, not specifically obj-c). Basically, I need to record a file (I have code to do this), then upload it to a server. I've looked at code to upload to servers and it seems that all I need from the server side of things is a html upload page with a php script, which I have. Another option would be ftp/sftp, although this would be harder to implement. The problem is I need to have authentication for the upload, and preferably have a secure (https) upload, with a username and password. I cannot figure out how to do this. I would also need the server to send back a response to the app.
Also, are their any frameworks to make it easier to upload files? I know there was asihttprequest, but that was discontinued...
What would I need to make the server do to have authentication and authenticated uploads, and be able to return data back to the app? Sorry for such a n00by question, but if you could help that would be great.
Thanks
Check out AFNetworking. I really enjoy doing file downloads and uploads using AFNetworking. The FAQ even gives an example on how to upload a file and download a file. All you need server side is a PHP script to handle a POST file upload.

Checking the progress of file download on the server side?

I am trying to build a service which allows to download music files. However after a user pays for a song, I want to be able to verify if the file was completely downloaded by the user or if the download failed in between. How can this be exercised? Thanks.
Theoretically you never know how many remaining packets the client will request. Therefore i see two options:
Dig deeeeep into your server code and come up with some hacky solution that somehow checks sent packets and tries to predict download completion
Write a native application that sends the progress back to the server (of course, then you will not have a web app any more)
As i understand user who pays for music have account on site. If he payed for music, add music to user's music list. And he will be able to download again in future. If download fail for any reason, user can re-download

How to record voice files using PHP, FLASH

I am developing an application where I need to record voice(for those who does not have a webcam so they can use only microphone to record voice) or video(those who have a a webcam - like laptop or external) files and save them on server, thereafter save the file name and logged in users id on database for later access.
I know I need to use some sort of flash app for this. But is there any free one which could server this purpose or even if there are paid ones which could serve this purpose that would be great. I tried google but may be I was not being able to go after the proper term or something, I could not succeed finding a proper solution for this.
Please, help me out!
You can do that simply using jRecorder, a jQuery plugin. You don't even need a Flash Media Server or RED server. JRecorder is same as jPlayer, you can use jQuery and HTML to design your recorder and you don't even need Flash or Action script knowledge for this.
jRecorder uses 1 pix hidden swf file which manages all the recording / previewing and sending the file data (wav file) to a URL you defined (Where you can write code in PHP or Java to receive a POST file)
It is quite simple and tidy.
You can download this Plugin from:
http://www.sajithmr.me/jrecorder-jquery
I have same feature in our latest project, the client want to have video recording from webcam and the video appear in the user's profile page.
For the server, we implement the RED5 server. It need a Java virtual machine in your hosting. You can read the detail requirement and installation instruction in the website.
To handle recording, we develop our own flash application, because the client request a custom interface to match with the overall website interface. I don't know the detail, since we outsource it to a fellow flash developer. Maybe you can see follow this thread, the development of flash recording by JeroenW.
To play recorded video, you can use any flash video player that support playing rtmp video source. You cannot play the recorded flv file in RED5 directly, since the file lack of metadata required by the player. Serving the recorded file as rtmp is done by RED5.
In addition to red5 there is Adobe's own Flash Media server that allows you to record audio/video straight to the server.
Or if you feel geeky you might be able to put together your own solution for this using a socket connection to the server and decoding the stream yourself on the server side. You should be able capture the audio/video locally into memory and then feed the byte stream up to your own server application.
There are Open Source solutions but you will need an own server to run them.
There is no way to run these things from shared hosting except if your provider is really nice, and ready to install the necessary software.
I asked the same question a few weeks back, check out the answers.
This question when googling "How to record audio php" comes up first so here for anyone from the future.
A simple way to record audio with flash and save it with PHP:
https://github.com/clouddueling/SimpleRecorder
Record audio, post audio data to your choice of url.
You could try recordmp3online.com which has an SDK. The nice thing about this one, is that it doesn't need a third party server(ala Red5), and supports mobile devices that don't have flash installed.

Categories