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

#1 2012-06-15 10:59:58

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Scratch FTP transporter

!!attention, it's not ftp anymore it's post, read some of the posts below!!

Hey guys,
I've got a quick question I'm hoping you can help me with.

I'm making a scratch mod, and I'm looking at how to upload projects to my server, obviously the best way would to be do it the same way as ST did, but the code there is a little too complex for me to try edit ip addresses and things but I found something when I was having a play with scratch 1.3, I looked through the system browser categories on the left and found, "Network-protocols" inside was an FTP transporter, this would be the best way for me to configure server end so I was wondering if anyone else knew how to do it?

Here is a link to my scratch mod's website

Any help with this would be greatly appreciated, thanks!

If I can't find a way, I suppose a PHP upload on my site would have the same effect...

Last edited by P110 (2012-06-16 02:29:15)


Me live on 2.0 now  sad

Offline

 

#2 2012-06-15 11:07:14

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

Re: Scratch FTP transporter

HTTP post would be the way to go...


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

Offline

 

#3 2012-06-15 11:14:48

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

MathWizz wrote:

HTTP post would be the way to go...

How can I access HTTP Post, also I am familiar with coding languages and HTTP and I think I kinda know what HTTP post is, but could you run me through it.


Me live on 2.0 now  sad

Offline

 

#4 2012-06-15 12:41:02

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

Re: Scratch FTP transporter

I'm writing some code... Gimme a minute.


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

Offline

 

#5 2012-06-15 12:59:39

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

MathWizz wrote:

I'm writing some code... Gimme a minute.

oh, great, Fantastic! THANKS!


Me live on 2.0 now  sad

Offline

 

#6 2012-06-15 13:00:24

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

Re: Scratch FTP transporter

I've got the smalltalk code (it goes in ScratchFrameMorph):

Code:

upload: url user: user password: password
    | t1 t2 t3 t4 t6 args |
    self stopAll.
    self world ifNotNil: [self world activeHand newKeyboardFocus: nil].
    self canonicalizeSoundsBits: nil saveOriginal: false.
    self canonicalizeImagesQuality: nil saveOriginal: false.
    t1 _ scriptsPane target.
    t2 _ scriptsPane tabPane currentTab.
    t3 _ viewerPane currentCategory.
    scriptsPane target: nil.
    workPane updateSpritesList.
    t4 _ workPane position.
    workPane delete; position: 0 @ 0.
    self updatePenPositions.
    ScriptableScratchMorph buildBlockSpecDictionary.
    workPane
        allMorphsDo: [:t7 | (t7 isKindOf: ScriptableScratchMorph)
                ifTrue: 
                    [t7 blocksBin
                        allMorphsDo: [:t8 | (t8 isKindOf: BlockMorph)
                                ifTrue: [t8 stop]].
                    t7 convertStacksToTuples]].

    t6 _ WriteStream on: (ByteArray new: 100000000).
    t6 nextPutAll: 'ScratchV02' asByteArray.
    self storeProjectInfoOn: t6.
    ObjStream new storeObj: workPane on: t6.

    workPane
        allMorphsDo: [:t7 | (t7 isKindOf: ScriptableScratchMorph)
                ifTrue: [t7 convertTuplesToStacks]].
    self addMorph: (workPane position: t4).
    t1 ifNil: [t1 _ workPane].
    t1 viewBlocksAndScripts.
    scriptsPane tabPane currentTab: t2.
    viewerPane currentCategory: t3.
    self updatePenPositions.

    args _ Dictionary new.
    args at: 'project' put: {projectName}.
    args at: 'data' put: (Array with: t6 contents asString).
    args at: 'user' put: {user}.
    args at: 'password' put: {password}.
    HTTPSocket httpPostDocument: url args: args

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

Offline

 

#7 2012-06-15 13:06:14

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Scratch FTP transporter

are you really sure you want to give people your ftp pass?  hmm

Offline

 

#8 2012-06-15 13:07:43

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

MathWizz wrote:

I've got the smalltalk code (it goes in ScratchFrameMorph):

Code:

upload: url user: user password: password
    | t1 t2 t3 t4 t6 args |
    self stopAll.
    self world ifNotNil: [self world activeHand newKeyboardFocus: nil].
    self canonicalizeSoundsBits: nil saveOriginal: false.
    self canonicalizeImagesQuality: nil saveOriginal: false.
    t1 _ scriptsPane target.
    t2 _ scriptsPane tabPane currentTab.
    t3 _ viewerPane currentCategory.
    scriptsPane target: nil.
    workPane updateSpritesList.
    t4 _ workPane position.
    workPane delete; position: 0 @ 0.
    self updatePenPositions.
    ScriptableScratchMorph buildBlockSpecDictionary.
    workPane
        allMorphsDo: [:t7 | (t7 isKindOf: ScriptableScratchMorph)
                ifTrue: 
                    [t7 blocksBin
                        allMorphsDo: [:t8 | (t8 isKindOf: BlockMorph)
                                ifTrue: [t8 stop]].
                    t7 convertStacksToTuples]].

    t6 _ WriteStream on: (ByteArray new: 100000000).
    t6 nextPutAll: 'ScratchV02' asByteArray.
    self storeProjectInfoOn: t6.
    ObjStream new storeObj: workPane on: t6.

    workPane
        allMorphsDo: [:t7 | (t7 isKindOf: ScriptableScratchMorph)
                ifTrue: [t7 convertTuplesToStacks]].
    self addMorph: (workPane position: t4).
    t1 ifNil: [t1 _ workPane].
    t1 viewBlocksAndScripts.
    scriptsPane tabPane currentTab: t2.
    viewerPane currentCategory: t3.
    self updatePenPositions.

    args _ Dictionary new.
    args at: 'project' put: {projectName}.
    args at: 'data' put: (Array with: t6 contents asString).
    args at: 'user' put: {user}.
    args at: 'password' put: {password}.
    HTTPSocket httpPostDocument: url args: args

Thanks, mind if i contact you if I have any problems,
Ok also, url=post bot? user=? pass=?, also, i seem a bit dum but post?


Me live on 2.0 now  sad

Offline

 

#9 2012-06-15 13:11:58

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

Re: Scratch FTP transporter

P110 wrote:

Ok also, url=post bot? user=? pass=?, also, i seem a bit dum but post?

The url is the server and directory of your server to post to. The username and password are things you need to implement in your server.


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

Offline

 

#10 2012-06-15 13:16:16

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

MathWizz wrote:

P110 wrote:

Ok also, url=post bot? user=? pass=?, also, i seem a bit dum but post?

The url is the server and directory of your server to post to. The username and password are things you need to implement in your server.

url=[...] how do I implement the user & pass I am being a dum dum :facepalm:


Me live on 2.0 now  sad

Offline

 

#11 2012-06-15 13:25:08

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

Re: Scratch FTP transporter

P110 wrote:

MathWizz wrote:

P110 wrote:

Ok also, url=post bot? user=? pass=?, also, i seem a bit dum but post?

The url is the server and directory of your server to post to. The username and password are things you need to implement in your server.

url=[...] how do I implement the user & pass I am being a dum dum :facepalm:

You want the people that upload projects to have accounts, right? Then you need a account system.


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

Offline

 

#12 2012-06-15 13:28:54

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

MathWizz wrote:

P110 wrote:

MathWizz wrote:


The url is the server and directory of your server to post to. The username and password are things you need to implement in your server.

url=[...] how do I implement the user & pass I am being a dum dum :facepalm:

You want the people that upload projects to have accounts, right? Then you need a account system.

oh, so set up a simple database? Hmmm... what would you reccomend for getting it all to work, also if there is anyway I can repay you please tell me!


Me live on 2.0 now  sad

Offline

 

#13 2012-06-15 13:35:16

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

Re: Scratch FTP transporter

P110 wrote:

oh, so set up a simple database? Hmmm... what would you reccomend for getting it all to work?

I've never actually made a system like that so I can't give you much support.  tongue

P110 wrote:

Also, if there is anyway I can repay you please tell me!

No need. I'm happy to help.  smile


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

Offline

 

#14 2012-06-15 13:38:32

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

MathWizz wrote:

P110 wrote:

oh, so set up a simple database? Hmmm... what would you reccomend for getting it all to work?

I've never actually made a system like that so I can't give you much support.  tongue

P110 wrote:

Also, if there is anyway I can repay you please tell me!

No need. I'm happy to help.  smile

I'll have a go with the system, could you give me some advice on how smalltalk send data.


Me live on 2.0 now  sad

Offline

 

#15 2012-06-15 13:40:33

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

Re: Scratch FTP transporter

P110 wrote:

I'll have a go with the system, could you give me some advice on how smalltalk send data.

I don't know for sure, but try:

Code:

$_POST[''project]

EDIT: You might have to change that to this:

Code:

$_POST['project']

tongue

Last edited by MathWizz (2012-06-15 13:41:05)


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

Offline

 

#16 2012-06-15 13:46:16

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

MathWizz wrote:

P110 wrote:

I'll have a go with the system, could you give me some advice on how smalltalk send data.

I don't know for sure, but try:

Code:

$_POST[''project]

EDIT: You might have to change that to this:

Code:

$_POST['project']

tongue

oh, that simple? php post variable


Me live on 2.0 now  sad

Offline

 

#17 2012-06-15 14:00:19

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

hey, sorry but the code doesn't work

Edit: Scratch ( tongue ) that, I was being incompetent...  tongue

Last edited by P110 (2012-06-15 14:12:08)


Me live on 2.0 now  sad

Offline

 

#18 2012-06-15 17:40:53

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

bump


Me live on 2.0 now  sad

Offline

 

#19 2012-06-15 18:19:51

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Scratch FTP transporter

I'd try and ask LS97, he coded one on Bingo to upload to Mod Share.

Offline

 

#20 2012-06-16 02:11:52

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

chanmanpartyman wrote:

I'd try and ask LS97, he coded one on Bingo to upload to Mod Share.

ok, thanks


Me live on 2.0 now  sad

Offline

 

#21 2012-06-16 02:13:53

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: Scratch FTP transporter

chanmanpartyman wrote:

I'd try and ask LS97, he coded one on Bingo to upload to Mod Share.

Actually, you should ask me. His just went to a URL and it was specified in GET variables. However, I wrote a tool to FTP upload to Mod Share in Insanity (however, I didn't code it in Squeak, I used AutoIT).


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#22 2012-06-16 02:58:31

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Scratch FTP transporter

jvvg wrote:

chanmanpartyman wrote:

I'd try and ask LS97, he coded one on Bingo to upload to Mod Share.

Actually, you should ask me. His just went to a URL and it was specified in GET variables. However, I wrote a tool to FTP upload to Mod Share in Insanity (however, I didn't code it in Squeak, I used AutoIT).

Oh. I never noticed the feature in insanity.

Offline

 

#23 2012-06-16 03:00:04

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: Scratch FTP transporter

chanmanpartyman wrote:

jvvg wrote:

chanmanpartyman wrote:

I'd try and ask LS97, he coded one on Bingo to upload to Mod Share.

Actually, you should ask me. His just went to a URL and it was specified in GET variables. However, I wrote a tool to FTP upload to Mod Share in Insanity (however, I didn't code it in Squeak, I used AutoIT).

Oh. I never noticed the feature in insanity.

Probably because it's a bit buggy. I will improve it when I return from my vacation (away from the computer containing the master copy).
Back to the original topic, I think the easiest way to use FTP is just to run an external program


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#24 2012-06-17 16:54:07

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

bump


Me live on 2.0 now  sad

Offline

 

#25 2012-06-20 01:18:04

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: Scratch FTP transporter

bump


Me live on 2.0 now  sad

Offline

 

Board footer