!!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)
Offline
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.
Offline
I've got the smalltalk code (it goes in ScratchFrameMorph):
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: argsOffline
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?
Offline
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.
Offline
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:
Offline
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.
Offline
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!
Offline
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.
P110 wrote:
Also, if there is anyway I can repay you please tell me!
No need. I'm happy to help.
Offline
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.
![]()
P110 wrote:
Also, if there is anyway I can repay you please tell me!
No need. I'm happy to help.
![]()
I'll have a go with the system, could you give me some advice on how smalltalk send data.
Offline
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:
$_POST[''project]
EDIT: You might have to change that to this:
$_POST['project']
Last edited by MathWizz (2012-06-15 13:41:05)
Offline
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']
![]()
oh, that simple? php post variable
Offline
I'd try and ask LS97, he coded one on Bingo to upload to Mod Share.
Offline
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).
Offline
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
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
Offline