asp.net mvc 3 - bits , sharpBits.net -
i using in project bits - background intelligent transfer service send file larg size. using sharpbits.net in c# code. want upload file server client. note sides.
-------------client side---------------
static void main(string[] args) {
string local = @"i:\a.mp3"; string destination = "http://192.168.56.128/bitstest/home/fileupload"; string remotefile = @destination; string localfile = local; if (!string.isnullorempty(localfile) && system.io.file.exists(localfile)) { var bitsmanager = new bitsmanager(); var job = bitsmanager.createjob("uploading file", jobtype.upload); job.notificationflags = notificationflags.joberroroccured | notificationflags.jobmodified | notificationflags.jobtransferred; job.addfile(remotefile, localfile); job.resume(); job.onjoberror += new eventhandler<joberrornotificationeventargs>(job_onjoberror); } }
this simple console application. local -- path file want send, destination -- path receiver remote server. when run program job.error take mi follow --- "the server's response not valid. server not following defined protocol. resume job, , background intelligent transfer service (bits) try again. -- bg_e_http_error_200 .-2145845048, 0x801900c8"
for client (receiver) have follow code: mvs 3 small project , view action go our destination path.
public actionresult fileupload() { try { httppostedfilebase file = request.files[0]; file.saveas(system.io.path.combine(server.mappath("/bitstest/"), file.filename)); } catch { } /*system.io.file.move(server.mappath("/bitstest/bin/aa.png"), server.mappath("/bitstest/content/aa.png"));*/ }
but fileupload action thas not recevie file. don't know how can receive file in client side. can see, used httppostedfilebase recive file not working.
my host server windows server 2008 r2 , done needed steps bits. more information can visit follow site http://technet.microsoft.com/en-us/library/cc431377.aspx ---- how configure windows server 2008 configuration manager 2007 site systems.
so don't know doing can receive file in host server.you can tell me can do.
with stateless methdology 1 web applications use, there no connection server once response completed. can poll server client side, client not listening server send additional bits.
in "the past" set activex controls, java applets, etc (silverlight today?) continue listen, not straight web style development.
html5 expands options, if willing use websocketapi. parts of html5, have risk using these bits implementation not browsers have adopted "standard" yet (adoption expected complete in next 10-12 years:->).
Comments
Post a Comment