Re: Upload file support in mathopd

Rabindra Paikaray <[email protected]> Tue, 2 Mar 2010 15:22:53 +0530
Newsgroups gmane.network.mathopd
Message-ID <[email protected]>
--0016368e2aa25cd8370480ce54f5
Content-Type: text/plain; charset=ISO-8859-1

Hi Michiel ,

I am pasting here my piece of code here in php
Which I am using for upload . it works for normal HTTP.
But with HTTPS it does not work for files of format other than .txt

My Code Below
FORM HANDLER
------------------------------
<html>
<body>
<form action="upload.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="upload" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>

UPLOAD HANDLER
-----------------------------------
<?php
if ($_FILES['upload']['error'] == 0)
{
     $fileName = $_FILES['upload']['name'];
     echo $filName;
     echo "Upload ok\n";
     if ($_FILES['upload']['size'] > 0)
     {
        echo  $_FILES['upload']['tmp_name'];
        $tmpName=$_FILES['upload']['tmp_name'];
     }
    move_uploaded_file($tmpName, "/tmp/testdoc");
}
?>

Thanks
Rabindra

On Thu, Feb 25, 2010 at 12:43 PM, Rabindra Paikaray
<[email protected]>wrote:

> Hi Michiel ,
> Thanks for your reply.
> I was trying the upload with php script .
> It is working nicely for all kinds of file format if I am using the normal
> http.
> If I am using the https (mathopd applied by the SSL patch provided) upload
> is happening . But when I am opening the file it's telling that unknown mime
> type.
> data integrity lost.
> Any idea about this.
>
>
> Thanks
> Rabindra
>
>
>
> On Wed, Feb 25, 2009 at 11:10 PM, Michiel Boland <[email protected]>wrote:
>
>> Rabindra Paikaray wrote:
>>
>>> Hi All,
>>> I want to know is mathopd supports file upload to server or not?
>>> Recently I was trying to upload the file , but it was failing .
>>> I don't know is it require to configure properly or it does not support
>>> at all.
>>>
>>
>> Mathopd by itself does not support file uploading, but you can do this via
>> CGI (PHP/Perl/Whatever)
>>
>> Cheers
>> Michiel
>>
>
>

--0016368e2aa25cd8370480ce54f5
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Michiel ,<br><br>I am pasting here my piece of code here in php<br>Which=
 I am using for upload . it works for normal HTTP.<br>But with HTTPS it doe=
s not work for files of format other than .txt<br><br>My Code Below<br><spa=
n style=3D"color: rgb(255, 0, 0);">FORM HANDLER</span><br style=3D"color: r=
gb(255, 0, 0);">
<span style=3D"color: rgb(255, 0, 0);">------------------------------</span=
><br>&lt;html&gt;<br>&lt;body&gt;<br>&lt;form action=3D&quot;upload.php&quo=
t; method=3D&quot;post&quot;<br>enctype=3D&quot;multipart/form-data&quot;&g=
t;<br>
&lt;label for=3D&quot;file&quot;&gt;Filename:&lt;/label&gt;<br>&lt;input ty=
pe=3D&quot;file&quot; name=3D&quot;upload&quot; id=3D&quot;file&quot; /&gt;=
<br>&lt;br /&gt;<br>&lt;input type=3D&quot;submit&quot; name=3D&quot;submit=
&quot; value=3D&quot;Submit&quot; /&gt;<br>
&lt;/form&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br><br><span style=3D"color=
: rgb(204, 0, 0);">UPLOAD HANDLER</span><br style=3D"color: rgb(204, 0, 0);=
"><span style=3D"color: rgb(204, 0, 0);">----------------------------------=
-</span><br>
&lt;?php<br>if ($_FILES[&#39;upload&#39;][&#39;error&#39;] =3D=3D 0)<br>{<b=
r>=A0=A0=A0=A0 $fileName =3D $_FILES[&#39;upload&#39;][&#39;name&#39;];<br>=
=A0=A0=A0=A0 echo $filName;<br>=A0=A0=A0=A0 echo &quot;Upload ok\n&quot;;<b=
r>=A0=A0=A0=A0 if ($_FILES[&#39;upload&#39;][&#39;size&#39;] &gt; 0)<br>
=A0=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0 echo=A0 $_FILES[&#39;upload&#39;][&=
#39;tmp_name&#39;];<br>=A0=A0=A0=A0=A0=A0=A0 $tmpName=3D$_FILES[&#39;upload=
&#39;][&#39;tmp_name&#39;];<br>=A0=A0=A0=A0 }<br>=A0=A0=A0 move_uploaded_fi=
le($tmpName, &quot;/tmp/testdoc&quot;);<br>}<br>?&gt;<br>
<br>Thanks<br>Rabindra<br><br><div class=3D"gmail_quote">On Thu, Feb 25, 20=
10 at 12:43 PM, Rabindra Paikaray <span dir=3D"ltr">&lt;<a href=3D"mailto:r=
[email protected]">[email protected]</a>&gt;</span> wrote:<br><blo=
ckquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204,=
 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Michiel ,<br>Thanks for your reply.<br>I was trying the upload with php =
script .<br>It is working nicely for all kinds of file format if I am using=
 the normal http.<br>If I am using the https (mathopd applied by the SSL pa=
tch provided) upload is happening . But when I am opening the file it&#39;s=
 telling that unknown mime type.<br>

data integrity lost.<br>Any idea about this. <br><br><br>Thanks<br><font co=
lor=3D"#888888">Rabindra</font><div><div></div><div class=3D"h5"><br><br><b=
r><div class=3D"gmail_quote">On Wed, Feb 25, 2009 at 11:10 PM, Michiel Bola=
nd <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_b=
lank">[email protected]</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>Rabindra Pai=
karay wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi All,<br>
I want to know is mathopd supports file upload to server or not?<br>
Recently I was trying to upload the file , but it was failing .<br>
I don&#39;t know is it require to configure properly or it does not support=
 at all.<br>
</blockquote>
<br></div>
Mathopd by itself does not support file uploading, but you can do this via =
CGI (PHP/Perl/Whatever)<br>
<br>
Cheers<br><font color=3D"#888888">
Michiel<br>
</font></blockquote></div><br>
</div></div></blockquote></div><br>

--0016368e2aa25cd8370480ce54f5--