Solved

upload image to server folder from windows mobile application so I can view on web app

Posted on 2008-06-11
7
940 Views
Last Modified: 2013-12-05
how can i send an image stored on a wm5/6 device using vb.net to a remote server folder and then delete the file from the device
0
Comment
Question by:csintera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 48

Accepted Solution

by:
Mikal613 earned 500 total points
ID: 21760990
To upload the file:

http://msdn.microsoft.com/en-us/library/aa446517.aspx

And delete the file

System.IO.file.Delete(strPath)

0
 

Author Comment

by:csintera
ID: 21763044
Thanks for the quick response , I have added the following to my solution

Public Sub UploadFile(ByVal localFile As String, ByVal uploadUrl As String)
        Dim req As HttpWebRequest = CType(WebRequest.Create(uploadUrl), HttpWebRequest)
        req.Method = "PUT"
        req.AllowWriteStreamBuffering = True
        ' Retrieve request stream and wrap in StreamWriter
        Dim reqStream As Stream = req.GetRequestStream()
        Dim wrtr As StreamWriter = New StreamWriter(reqStream)
          ' Open the local file
        Dim rdr As StreamReader = New StreamReader(localFile)
          ' loop through the local file reading each line
        '  and writing to the request stream buffer
        Dim inLine As String = rdr.ReadLine()

        While Not inLine Is Nothing
            wrtr.WriteLine(inLine)
            inLine = rdr.ReadLine()
        End While

        rdr.Close()
        wrtr.Close()

        req.GetResponse()
    End Sub

an a  button with

UploadFile((Path.Combine(AppPath, job_no + "CapturedSignature1.bmp")), uploadurl)

do I need to do anything else as it seems to be getting stuck around the      Dim inLine As String = rdr.ReadLine() and the error message on the mobile device is

ioexception
an error message cannot be displayed because an optional resource assembly containing it cannot be found

at system.IO._error.winIOerror()
at system.io.file.delete()

etc
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 21763083
is the streamreader null?
0
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

 

Author Comment

by:csintera
ID: 21763162
not sure i included this before i call the upload file

Dim value As StreamReader

        value = StreamReader.Null

is this correct ? , I also now get a different error message

system.net.httpwebrequest.getresponse()
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 21763178
did you try debugging the code?

Put a breakpoint on that line and mouse over the text. It shoud give you the value
0
 

Author Comment

by:csintera
ID: 21764148
I get

the code called into another function, when that function has finished, this is the next statement that will be executed


System.Net.WebException was unhandled
  Message="An error message cannot be displayed because an optional resource assembly containing it cannot be found"
  StackTrace:
    at System.Net.HttpWebRequest.finishGetResponse()
    at System.Net.HttpWebRequest.GetResponse()
    at kmhpda.custSig.UploadFile()
    at kmhpda.custSig.btnSave_Click()
    at System.Windows.Forms.Control.OnClick()
    at System.Windows.Forms.Button.OnClick()
    at System.Windows.Forms.ButtonBase.WnProc()
    at System.Windows.Forms.Control._InternalWnProc()
    at Microsoft.AGL.Forms.EVL.EnterMainLoop()
    at System.Windows.Forms.Application.Run()
    at kmhpda.custSig.Main()
0
 

Author Comment

by:csintera
ID: 21784576
any help on this is very much welcome
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question