This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#326 2010-10-08 18:50:09

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Lets make a new Scratch viewer!

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.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#327 2010-10-09 03:12:56

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

I'll make an upload form on my site if u like!  big_smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#328 2010-10-09 04:16:52

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

Daffy22 can you work out how to link it to MathWizz's code and put up a demo. Then explain how.


You can now reach me on Twitter @johnnydean1_

Offline

 

#329 2010-10-09 04:41:42

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

johnnydean1 wrote:

Daffy22 can you work out how to link it to MathWizz's code and put up a demo. Then explain how.

yes I can but what does MathWizz's code do?  big_smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#330 2010-10-09 05:57:11

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

You upload a project and it tells you if its a Scratch project or not!


You can now reach me on Twitter @johnnydean1_

Offline

 

#331 2010-10-09 06:06:07

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

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!  big_smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#332 2010-10-09 07:42:56

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Lets make a new Scratch viewer!

Daffy22 wrote:

I'll make an upload form on my site if u like!  big_smile

No, give me the code and I'll put it on the site for this.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#333 2010-10-09 08:30:07

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

okay:
1. put this in a .html doc called form.html

Code:

<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.  sad


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#334 2010-10-09 09:23:27

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

Thank you. Can you put that up on our website please SRR


You can now reach me on Twitter @johnnydean1_

Offline

 

#335 2010-10-09 09:37:19

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

oh and SRR what host r u using?


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#336 2010-10-09 09:43:53

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Lets make a new Scratch viewer!

Daffy22 wrote:

okay:
1. put this in a .html doc called form.html

Code:

<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.  sad

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.


nXIII

Offline

 

#337 2010-10-09 09:46:10

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

nXIII wrote:

Daffy22 wrote:

okay:
1. put this in a .html doc called form.html

Code:

<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.  sad

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.  wink


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#338 2010-10-09 09:49:06

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Lets make a new Scratch viewer!

Daffy22 wrote:

We need to allow users to upload the project first before playing it.  wink

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)


nXIII

Offline

 

#339 2010-10-09 09:56:34

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

nXIII wrote:

Daffy22 wrote:

We need to allow users to upload the project first before playing it.  wink

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!  big_smile

_____________
Note to all: If we get this player really good I will use this on mod share to play projects made with mods!  big_smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#340 2010-10-09 09:57:14

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Lets make a new Scratch viewer!

nXIII wrote:

enctype="multipart/form-data"

VERY IMPORTANT!


/* No comment */

Offline

 

#341 2010-10-09 09:59:43

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

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!  big_smile

Well you would have to change the code a bit but yes...


You can now reach me on Twitter @johnnydean1_

Offline

 

#342 2010-10-09 10:05:47

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

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!  big_smile

Well you would have to change the code a bit but yes...

I know but then i can play projects made with mods!  big_smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#343 2010-10-09 16:33:47

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Lets make a new Scratch viewer!

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)


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#344 2010-10-09 16:39:08

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

I dont know.. Maybe link it to a external site with the viewer!


You can now reach me on Twitter @johnnydean1_

Offline

 

#345 2010-10-09 19:56:04

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Lets make a new Scratch viewer!

johnnydean1 wrote:

I dont know.. Maybe link it to a external site with the viewer!

I'll work on that.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#346 2010-10-09 21:59:02

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Lets make a new Scratch viewer!

"Fatal error: Allowed memory size of 134217728 bytes exhausted..."
tongue  Is there a way to up the memory or do I have to figure out a different way of doing it?


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#347 2010-10-09 22:26:27

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Lets make a new Scratch viewer!

MathWizz wrote:

"Fatal error: Allowed memory size of 134217728 bytes exhausted..."
tongue  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....


nXIII

Offline

 

#348 2010-10-10 03:38:37

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

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!  big_smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#349 2010-10-10 08:26:22

pwiter
Scratcher
Registered: 2010-06-02
Posts: 100+

Re: Lets make a new Scratch viewer!

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!  big_smile

Free Hosting Cloud is always down!  sad


http://i.imgur.com/YBeXc.png

Offline

 

#350 2010-10-10 09:35:20

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

Ok then not free hosting cloud


You can now reach me on Twitter @johnnydean1_

Offline

 

Board footer