MathWizz wrote:
ScratchReallyROCKS wrote:
johnnydean1 wrote:
Can you make it?
I guess so. I'll do that.
EDIT: Never mind, I can do the upload dialog, but I can't figure out how to link it to MathWizz's code. nXIII?Huh? What do you need to do?
I'm trying to attach an upload dialog to your php code so I can put it on the website.
Offline
Daffy22 can you work out how to link it to MathWizz's code and put up a demo. Then explain how.
Offline
You upload a project and it tells you if its a Scratch project or not!
Offline
johnnydean1 wrote:
You upload a project and it tells you if its a Scratch project or not!
okay I'll do that however my server is down at the momment so if you leave it until this evening it should be fine!
Offline
Daffy22 wrote:
I'll make an upload form on my site if u like!
![]()
No, give me the code and I'll put it on the site for this.
Offline
okay:
1. put this in a .html doc called form.html
<html> <head> <title>upload form</title> </head> <body> <form name="upload" action="upload.php" method="POST"> <input type="file" name="file"> <input type="submit" value="Upload"> </form> </body> </html>
2. put this code in a doc called upload.php
<?php
if ($_FILES["file"]["size"] < 200000000) // size limit
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>3. make a dir called 'upload'
4. Now run form.html and select a .sb file.
5. Click upload and hopefully it should upload however I have not tested my script
PS: what server are you using, some servers don't allow PHP let alone file upload.
Offline
Thank you. Can you put that up on our website please SRR
Offline
Daffy22 wrote:
okay:
1. put this in a .html doc called form.htmlCode:
<html> <head> <title>upload form</title> </head> <body> <form name="upload" action="upload.php" method="POST"> <input type="file" name="file"> <input type="submit" value="Upload"> </form> </body> </html>2. put this code in a doc called upload.php
Code:
<?php if ($_FILES["file"]["size"] < 200000000) // size limit { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?>3. make a dir called 'upload'
4. Now run form.html and select a .sb file.
5. Click upload and hopefully it should upload however I have not tested my script
PS: what server are you using, some servers don't allow PHP let alone file upload.![]()
you forgot to use the enctype attribute, and there's no reason to upload the file; just use file_get_contents(...) on the temp file name.
Offline
nXIII wrote:
Daffy22 wrote:
okay:
1. put this in a .html doc called form.htmlCode:
<html> <head> <title>upload form</title> </head> <body> <form name="upload" action="upload.php" method="POST"> <input type="file" name="file"> <input type="submit" value="Upload"> </form> </body> </html>2. put this code in a doc called upload.php
Code:
<?php if ($_FILES["file"]["size"] < 200000000) // size limit { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?>3. make a dir called 'upload'
4. Now run form.html and select a .sb file.
5. Click upload and hopefully it should upload however I have not tested my script
PS: what server are you using, some servers don't allow PHP let alone file upload.![]()
you forgot to use the enctype attribute, and there's no reason to upload the file; just use file_get_contents(...) on the temp file name.
oops I fogot that bit.
Any way it shoud still work.
____________________
We need to allow users to upload the project first before playing it.
Offline
Daffy22 wrote:
We need to allow users to upload the project first before playing it.
![]()
No, look:
<form action="index.php" enctype="multipart/form-data" method="post">'+
'<p><input type="file" name="sbfile" />'+
'</p><div style="position: absolute; bottom: 0px; right: 0px;">'+
'<input type="submit" value="Open" />'+
'<input type="button" value="Cancel" onclick="c(\'OpenC\');" />'+
'</div>'+
'</form>(randomly pasted JavaScript code)
+
file_get_contents($_FILES["sbfile"]["tmp_name"]
(randomly pasted PHP code)
Offline
nXIII wrote:
Daffy22 wrote:
We need to allow users to upload the project first before playing it.
![]()
No, look:
Code:
<form action="index.php" enctype="multipart/form-data" method="post">'+ '<p><input type="file" name="sbfile" />'+ '</p><div style="position: absolute; bottom: 0px; right: 0px;">'+ '<input type="submit" value="Open" />'+ '<input type="button" value="Cancel" onclick="c(\'OpenC\');" />'+ '</div>'+ '</form>(randomly pasted JavaScript code)
+Code:
file_get_contents($_FILES["sbfile"]["tmp_name"](randomly pasted PHP code)
maybe your right!
_____________
Note to all: If we get this player really good I will use this on mod share to play projects made with mods!
Offline
nXIII wrote:
enctype="multipart/form-data"
VERY IMPORTANT!
Offline
Daffy22 wrote:
Note to all: If we get this player really good I will use this on mod share to play projects made with mods!
![]()
Well you would have to change the code a bit but yes...
Offline
johnnydean1 wrote:
Daffy22 wrote:
Note to all: If we get this player really good I will use this on mod share to play projects made with mods!
![]()
Well you would have to change the code a bit but yes...
I know but then i can play projects made with mods!
Offline
johnnydean1 wrote:
Thank you. Can you put that up on our website please SRR
Sorry, I was doing something this morning.
EDIT: would you know how to upload the "upload.php" file to weebly?
Last edited by ScratchReallyROCKS (2010-10-09 16:35:18)
Offline
I dont know.. Maybe link it to a external site with the viewer!
Offline
johnnydean1 wrote:
I dont know.. Maybe link it to a external site with the viewer!
I'll work on that.
Offline
MathWizz wrote:
"Fatal error: Allowed memory size of 134217728 bytes exhausted..."
Is there a way to up the memory or do I have to figure out a different way of doing it?
You're probably doing infinite recursion if you did that....
Offline
ScratchReallyROCKS wrote:
johnnydean1 wrote:
Thank you. Can you put that up on our website please SRR
Sorry, I was doing something this morning.
EDIT: would you know how to upload the "upload.php" file to weebly?
You using weebly???!!!
You need a host that allows PHP like freehostingcloud. They let you have MYSQL databases, unlimited web space, no adds, loads of extra features too!
Offline
Daffy22 wrote:
ScratchReallyROCKS wrote:
johnnydean1 wrote:
Thank you. Can you put that up on our website please SRR
Sorry, I was doing something this morning.
EDIT: would you know how to upload the "upload.php" file to weebly?You using weebly???!!!
You need a host that allows PHP like freehostingcloud. They let you have MYSQL databases, unlimited web space, no adds, loads of extra features too!![]()
Free Hosting Cloud is always down!
Offline
Ok then not free hosting cloud
Offline