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><html><br><body><br><form action=3D"upload.php&quo=
t; method=3D"post"<br>enctype=3D"multipart/form-data"&g=
t;<br>
<label for=3D"file">Filename:</label><br><input ty=
pe=3D"file" name=3D"upload" id=3D"file" />=
<br><br /><br><input type=3D"submit" name=3D"submit=
" value=3D"Submit" /><br>
</form><br></body><br></html><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>
<?php<br>if ($_FILES['upload']['error'] =3D=3D 0)<br>{<b=
r>=A0=A0=A0=A0 $fileName =3D $_FILES['upload']['name'];<br>=
=A0=A0=A0=A0 echo $filName;<br>=A0=A0=A0=A0 echo "Upload ok\n";<b=
r>=A0=A0=A0=A0 if ($_FILES['upload']['size'] > 0)<br>
=A0=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0 echo=A0 $_FILES['upload'][&=
#39;tmp_name'];<br>=A0=A0=A0=A0=A0=A0=A0 $tmpName=3D$_FILES['upload=
']['tmp_name'];<br>=A0=A0=A0=A0 }<br>=A0=A0=A0 move_uploaded_fi=
le($tmpName, "/tmp/testdoc");<br>}<br>?><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"><<a href=3D"mailto:r=
[email protected]">[email protected]</a>></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'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"><<a href=3D"mailto:[email protected]" target=3D"_b=
lank">[email protected]</a>></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'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--