cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: What is the best way to debug this?

From: Igor Korot <ikorot01_at_gmail.com>
Date: Thu, 19 Jul 2012 15:55:36 -0700

Daniel,

On Thu, Jul 19, 2012 at 1:48 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 16 Jul 2012, Igor Korot wrote:
>
>>> Why not use CURLOPT_HTTPPOST then? Helps you with all the tricky
>>> details...
>>> See http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHTTPPOST
>>
>>
>> If I switch to that option do I have to set
>> CURLOPT_INFILESIZE/CURLOPT_INFILESIZE_LARGE?
>
>
> No.

Good. ;-)

>
>
>> And what about my previous E-mail in this thread?
>
>
> Can you please be more specific? What are you asking about?

I'm referring to the following in one of the previous E-mails in this thread:

[quote]

Now I finally got a hold of the server code. I'm not an expert on this
but hopefully someone here
can tell me if I'm right.

[code]
default.aspx

<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>

    <div>
    <form id="Form2" Method="Post" EncType="Multipart/Form-Data" RunAt="Server">

   <%-- The File upload Html control --%>
   Choose Your File To Upload <BR>
   <Input Name="MyFile" id="MyFile" Type="File" RunAt="Server">
   <BR>

   <%-- A button - when clicked the form is submitted and the
            Upload_Click event handler is fired... --%>
   <Input id="Submit1" Type="Submit" Value="Upload"
             RunAt="Server">

    </form> </div>
</body>
</html>

Default.aspx.vb
Imports System.IO

Partial Class _Default

    Inherits System.Web.UI.Page
    Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
        'If Page.IsPostBack Then
        'Grab the file name from its fully qualified path at client
        Dim strFileName As String = MyFile.PostedFile.FileName
        'Response.Write(strFileName)
        ' only the attched file name not its path
        Dim c As String = System.IO.Path.GetFileName(strFileName)

        'Save uploaded file to server at C:\ServerFolder\
        Try
            MyFile.PostedFile.SaveAs("C:\inetpub\wwwroot\TouchAndRead\files\"
+ c)

        Catch Exp As Exception

        End Try
/*
more code for file processing here
*/

2 things:
1. I think Default.aspx.vb is missing following line:

InputText MyFile = new InputText;

as the code references NULL object. Am I right?
If I am right is it possible that this is the cause of the "Failure
writing the body"
error?

2. If I run the code on Mac where the file name will be something like
"/home/igor/temp/12345.bmp" will this code handle the name properly
and variable "c" will contain "12345.bmp"?

Thank you for any clarification.
[/quote]

Sorry about confusion. I guess we typed the replies at the same time.
Thank you for all those answers. They've been very helpful.

>
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-20